3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getNumsOdd(array $nums) { foreach($nums as $key => (int)$num) { if ($num % 2) { yield $key => $num; } } } foreach(getNumsOdd([1,3,4,5,6] as $key => $num) { echo $num.PHP_EOL; }
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '(int)' (int) (T_INT_CAST) in /in/etjjd on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_INT_CAST in /in/etjjd on line 4
Process exited with code 255.

preferences:
182.06 ms | 1395 KiB | 67 Q