3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g1() { yield 2; yield 3; return 42; } function g2() { yield 1; $g1result = yield from g1(); yield 4; return $g1result; } var_dump(iterator_to_array(g2())); $g = g2(); $a = []; foreach ($g as $yielded) { $a[] = $yielded; } var_dump($a); var_dump($g->getReturn());
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> int(2) [1]=> int(4) } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } int(42)

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:
60.91 ms | 2232 KiB | 4 Q