3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function generator() { $i=0; echo "Generating value...\r\n"; yield $i; $i++; echo "Incremeting \r\n"; } $x = generator(); for ($i=0;$i<10;$i++) { echo "Getting value"; echo $x(); }
Output for 7.0.0 - 7.3.0rc4
Getting value Fatal error: Uncaught Error: Function name must be a string in /in/aQmVv:15 Stack trace: #0 {main} thrown in /in/aQmVv on line 15
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Getting value Fatal error: Function name must be a string in /in/aQmVv on line 15
Process exited with code 255.