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(); dump($generator); // foreach ($generator as $value) { // echo "$value\n"; // }
based on LnI5J
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Call to undefined function dump() in /in/uncCY:11 Stack trace: #0 {main} thrown in /in/uncCY on line 11
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Call to undefined function dump() in /in/uncCY:11 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function dump() in /in/uncCY on line 11
Process exited with code 255.