3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function ping_pong() { for ($i = 1; $i <= 10; $i++) { $val = (yield $i)); echo 'ping: ' . $val . PHP_EOL; } } $generator = ping_pong(); foreach ($generator as $value) { echo 'pong: ' . $generator->send($value) . PHP_EOL; }
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/Wk7QT on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/Wk7QT on line 7
Process exited with code 255.