3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getNumsOdd(array $nums) { foreach($nums as $key => $num) { if ($num % 2) { yield $key => $num; } } } while($num = getNumsOdd([1,3,4,5,6])) { var_dump($num); if (++$i = 10){ break; } } /*foreach(getNumsOdd([1,3,4,5,6]) as $key => $num) { echo $key . '=>' . $num.PHP_EOL; }*/
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '$key' (T_VARIABLE) in /in/mh2af 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/mh2af on line 6
Process exited with code 255.