3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sponges = function() { for ($i = 1; $i <= 3; $i++) { // Note that $i is preserved between yields. yield $i; } } $generator = $sponges(); foreach ($generator as $value) { echo "$value\n"; }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/SgtcS 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/SgtcS on line 6
Process exited with code 255.