/* Prepare the read array * / $read = array( $stream1, $stream2); if (false === ($num_changed_streams = stream_select($read, $write = NULL, $except = NULL, 0))) {/ * Error handling * / else if ($num_changed_streams 0) {/ * At least on one of the streams something interesting happened * /}
You do not need to pass every array to stream_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 stream_select() returns.