3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function gen_one_to_three() { for ($i = 1; $i <= 10; $i++) { (yield $i) = $a var_dump($a); } } $generator = gen_one_to_three(); foreach ($generator as $value) { $generator->send('cheese'); var_dump($value); }
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/NgCuI on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/NgCuI on line 6
Process exited with code 255.