3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen(int $x) { $x = yield $x + 1; $x = yield $x + 2; $x = yield $x + 3; $x = yield $x + 4; } $gen = gen(5); $assertions = [ ['expect' => 6], ['send' => 1, 'expect' => 3], ['send' => 5, 'expect' => 8], ['send' => 3, 'expect' => 7], ]; foreach($assertions as $assertion) { if(!array_key_exists('send', $assertion)) { echo '(Received / Initial Assertion / Whatever) ' . $gen->current() . PHP_EOL; continue; } echo $assertion['expect'] . ' === ' . $gen->send($assertion['send']) . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
(Received / Initial Assertion / Whatever) 6 3 === 3 8 === 8 7 === 7

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:
26.4 ms | 405 KiB | 5 Q