/* Prepare the read array * / $read = array( $socket1, $socket2); if (false === ($num_changed_sockets = socket_select($read, $write = NULL, $except = NULL, 0))) {/ * Error handling * / else if ($num_changed_sockets 0) {/ * At least at one of the sockets something interesting happened * /}
You do not need to pass every array to socket_select(). You can leave it out and use an empty array or NULL instead. Also do not forget that those arrays are passed by reference and will be modified after socket_select() returns.