3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { echo "Gen1\n"; $a = yield 1; echo "Resumed. a is $a\n"; } function gen2() { echo "Gen2\n"; $b = yield 2; echo "Resumed. b is $b\n"; } function yf() { yield from gen1(); echo "Between\n"; yield from gen2(); } $g = yf(); echo "Autoprime\n"; var_dump($g->current()); echo "Sending\n"; var_dump($g->send(42)); echo "Done\n";
Output for git.master, git.master_jit, rfc.property-hooks
Autoprime Gen1 int(1) Sending Resumed. a is 42 Between Gen2 int(2) Done

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