3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_ints($n){ foreach ( range(0,$n) as $number) { $number = (yield $number); yield $number; } } $gen = generate_ints(5); // iterable object can be used in foreach foreach ($gen as $g) { var_dump($g); echo $g; if ($gen->current() == 4) { $gen->send("\n999\n"); // injecting a value echo $gen->current(); } }
Output for git.master, git.master_jit, rfc.property-hooks
int(0) 0NULL int(1) 1NULL int(2) 2NULL int(3) 3NULL int(4) 4 999 int(5) 5NULL

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