3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pipe { var $stderr; } function generator_eval(Generator $gen) { foreach ($gen as $k => $v) {} } function words() { foreach (["foo", "bar", "baz"] as $word) { yield $word; } } function uppercase(Traversable $in, $error) { foreach ($in as $word) { yield strtoupper($word); } $error->send(new Exception("foo")); } function each_println(Traversable $in) { foreach ($in as $line) { echo "$line\n"; } } $stderr = function() { for (;;) { $error = (yield); fwrite(STDERR, "Error! $error\n"); } }; each_println(uppercase(words(), $stderr()));

preferences:
43.59 ms | 402 KiB | 5 Q