3v4l.org

run code in 200+ 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; echo $i; } } $generator = gen_one_to_three(); foreach ($generator as $value) { echo "$value\n"; } ?>
based on gjJIg
Output for 5.6.0 - 7.3.0alpha1
123 Warning: Invalid argument supplied for foreach() in /in/sW4og on line 11