3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen1() { yield 1; echo "Hi\n"; yield 2; echo "Bye\n"; } foreach(gen1() as $val) { echo "Iteration\n"; var_dump($val); }
based on dCHNj
Output for 5.5.24 - 7.2.0
Iteration int(1) Hi Iteration int(2) Bye
Output for 5.4.9 - 5.4.45
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/hOT58 on line 4
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_LNUMBER in /in/hOT58 on line 4
Process exited with code 255.