Lazy Line · Level 8 of 8

No going back

The same generator looped over twice.

<?phpfunction two() {    yield 1;    yield 2;}$gen = two();foreach ($gen as $n) {    echo $n . PHP_EOL;}try {    foreach ($gen as $n) {        echo $n . PHP_EOL;    }} catch (Exception $e) {    echo $e->getMessage() . PHP_EOL;}

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…