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; } } $generator = gen_one_to_three(); var_dump($generator->current()); // foreach ($generator as $value) { // echo "$value\n"; // }
based on IgFeV
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
int(1)