3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function grep($pattern) { echo "Looking for $pattern\n"; while (true) { $line = (yield); if (false !== strpos($line, $pattern) { echo "$line\n"; } } } // Imagine we parsed a file which returned the following lines. $lines = array( "<?php\n", "echo 'toto';", ); $g = grep('php'); foreach ($lines as $line) { $g->send($line); }
Output for 5.3.0 - 5.4.26
Parse error: syntax error, unexpected '{' in /in/Ced2C on line 7
Process exited with code 255.