- var_dump: documentation ( source)
<?php
$f = function () {
$i = 0;
while (true) {
yield ++$i;
if ($i > 5) {
goto end;
}
}
end:
var_dump('End of iterator');
};
foreach ($f() as $i) {
var_dump($i);
}