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.3.0 - 8.3.31, 8.4.1 - 8.4.21, 8.5.0 - 8.5.7
h:1 - i:1 + h:2 - i:1 + h:3 - i:1 + h:4 - i:1 +

preferences:
29.14 ms | 734 KiB | 4 Q