<?php class E1 extends Exception {} function g() { static $i; for ($i = 0; $i < 5; ++$i) { if ($i === 3) { throw new E1; } yield "foo $i\n"; } yield 'bar'; // You will never get this. } $g = g(); for ($i = 0; $i < 5; ++$i) { try { $g->next(); } catch (Exception $e) { } $output = $g->current(); echo "$output\n"; }
You have javascript disabled. You will not be able to edit any code.