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, Generator $error) { foreach ($in as $word) { yield strtoupper($word); } } function each_println(Traversable $in) { foreach ($in as $line) { echo "$line\n"; } } $stderr = function() { for (;;) { $error = (yield); echo "Error! $error\n"; } }; each_println(uppercase(words(), $stderr()));

preferences:
34.97 ms | 402 KiB | 5 Q