/*
353 = RPL_NAMREPLY
"<channel> :[[@|+]<nick> [[@|+]<nick> [...]]]"
366 = RPL_ENDOFNAMES
"<channel> :End of /NAMES list"
- To reply to a NAMES message, a reply pair consisting of RPL_NAMREPLY and RPL_ENDOFNAMES is sent by the server back to the client. If there is no channel found as in the query, then only RPL_ENDOFNAMES is returned. The exception to this is when a NAMES message is sent with no parameters and all visible channels and contents are sent back in a series of RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark the end.
*/
// replycode 353 handler ($cmd = untoutched data from $read)
if (strpos($cmd, 353) !== false)
{
//Search reply code 353 (int)
$replyCodePos = strpos($cmd, 353);
//Search reply code 366 (int) to get end of the name list.
$replyCodeEndLine = strpos($cmd, 366);
//extract data between reply code 353 and reply code 366.
$replyCode = substr($cmd, $replyCodePos, $replyCodeEndLine);
echo "\nUsers in channel are: $replyCode\n"; // should show the part with names and some other things of the NAMES Command
}