3v4l.org

run code in 500+ PHP versions simultaneously
<?php $g = function (): Generator { yield from [1,2,3,4]; }; foreach($g() as $h) { print "h:$h - "; foreach($g() as $i) { echo "i:$i + "; break 1; } }
Output for 8.2.31 - 8.2.32, 8.3.0 - 8.3.33, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
h:1 - i:1 + h:2 - i:1 + h:3 - i:1 + h:4 - i:1 +

preferences:
47.66 ms | 765 KiB | 4 Q