3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
178.6 ms | 2044 KiB | 11 Q