3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen1(){ for($i=0;$i<=10;$i++){ yield $i; } echo "OK!"; } function gen2(){ for($i=0;$i<=10;$i++){ yield $i; } echo "OK2"; } echo gen1(); echo gen2();
based on LgGg2
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class Generator could not be converted to string in /in/iEqCs on line 18
Process exited with code 255.
Output for 5.5.24 - 7.0.20
Catchable fatal error: Object of class Generator could not be converted to string in /in/iEqCs on line 18
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/iEqCs on line 5
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/iEqCs on line 5
Process exited with code 255.