3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen(){ yield 0; yield from [1]; yield from [2]; yield 3; } foreach(gen() as $k => $v){ echo $k . " => " . $v . "\n"; }
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
0 => 0 0 => 1 0 => 2 1 => 3
Output for 5.6.0 - 5.6.40
0 => 0 Notice: Use of undefined constant from - assumed 'from' in /in/dqCkl on line 5 1 => r Notice: Use of undefined constant from - assumed 'from' in /in/dqCkl on line 6 2 => o 3 => 3

preferences:
78.48 ms | 1932 KiB | 4 Q