3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function xrange($start, $limit, $step = 1) { $array = array(); for ($i = $start; $i <= $limit; $i += $step) { $array[] = $i; } return $array; } foreach (xrange(0, 100, 5) as $i) { print $i . PHP_EOL; } function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } foreach (xrange(0, 100, 5) as $i) { print $i . PHP_EOL; }
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/Qmthu on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/Qmthu on line 14
Process exited with code 255.