3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function gen_one_to_three() { for ($i = 1; $i <= 3; $i++) { // Note that $i is preserved between yields. yield $i; } } $generator = gen_one_to_three(); foreach ($generator as $value) { echo "$value\n"; } ?><?php
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/f8IK1 on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/f8IK1 on line 5
Process exited with code 255.