3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { yield 1; yield 2; yield 3; } function yf($iter) { $isSubgenerator = $iter instanceof Generator; foreach($iter as $val) { $x = yield $val; echo "Got $x from a yieldn\n"; } } $g = yf(gen1()); $g->next(); var_dump($g->current()); $g->send(10); var_dump($g->current()); $g->send(20); var_dump($g->current());
Output for git.master, git.master_jit, rfc.property-hooks
Got from a yieldn int(2) Got 10 from a yieldn int(3) Got 20 from a yieldn NULL

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:
50.57 ms | 401 KiB | 8 Q