3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen(): Generator { yield new stdClass() => 'foo'; yield ['a'] => 'foo'; yield gen2() => 'foo'; yield fn($a) => 'b' => 'c'; } function gen2(): Generator { yield 'bar'; } gen(); foreach(gen() as $key => $value) { var_dump($key, $value); }

preferences:
46.8 ms | 402 KiB | 5 Q