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.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
h:1 - i:1 + h:2 - i:1 + h:3 - i:1 + h:4 - i:1 +

preferences:
61.83 ms | 757 KiB | 4 Q