3v4l.org

run code in 300+ PHP versions simultaneously
<?php $matchesMatches = function ($matches) { //$m = 1; //yield $m; // could put as a `for` so it is more optimized, but for now, that is premature optimization foreach ($matches as $match) { var_dump($match); // yeild $m; for ($i = 1; $i <= 3; $i++) { // Note that $i is preserved between yields. yield $i; } } }; $matches = [1,2, 3]; $matches = [1 => array('a', 'b'), 2 => array('c', 'd'), 3 => array('e', 'f')]; foreach ($matchesMatches($matches) as $m) { var_dump($m); }
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } int(1) int(2) int(3) array(2) { [0]=> string(1) "c" [1]=> string(1) "d" } int(1) int(2) int(3) array(2) { [0]=> string(1) "e" [1]=> string(1) "f" } int(1) int(2) int(3)

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:
56.8 ms | 402 KiB | 8 Q