3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Register callbacks to be invoked when a stream is readable $onRead = function(resource $stream) { echo stream_get_contents($stream, -1, 10) . PHP_EOL; } while (true) { // This blocks, UNTIL we get a read / write stream in stream_select($readStreams, $writeStreams, $oobStreams, $timeoutSecs, $timeoutUsecs); // We get to here because we got a read / write stream foreach ($readStreams as $readStream) { $onRead($readStream); } }
Output for 7.1.0 - 7.1.16, 7.2.0 - 7.2.4
Parse error: syntax error, unexpected 'while' (T_WHILE) in /in/5JkFR on line 8
Process exited with code 255.

preferences:
171.13 ms | 1000 KiB | 7 Q