3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { // TODO: HHVM currently does not support yield from (or yield) as // expressions. As such, this test had to be slightly modified. // The original line was: // var_dump(yield from gen($a + 1)); //$b = yield from gen($a + 1); yield 1; yield 2; var_dump('in the middle of gen'); yield 3; yield 4; } function bar($gen) { // TODO: HHVM currently does not support yield from (or yield) as // expressions. As such, this test had to be slightly modified. // The original line was: // var_dump(yield from gen($a + 1)); yield from $gen; } /* Twice a Generator from bar() using yield from on $gen */ $gen = gen(); $gens[] = bar($gen); $gens[] = bar($gen); do { foreach ($gens as $g) { var_dump($g->current()); $g->next(); } } while($gens[0]->valid()); var_dump($gens[1]->valid());
Output for git.master, git.master_jit, rfc.property-hooks
int(1) int(2) string(20) "in the middle of gen" int(3) int(4) int(4) NULL bool(false)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.9 ms | 401 KiB | 8 Q