3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mod(&$item){ $item["position"] = preg_replace("/[^0-9]+/","",$item["position"]); $item["count"] = 2*$item["count"]; } $items = [ ["position" => "1", "count" => 4], ["position" => "2", "count" => 3], ]; echo "before: \n"; foreach($items as $item){ var_dump($item) . "\n"; } echo "modifying items...\n"; foreach($items as &$itemRef){ mod($itemRef); } echo "after: \n"; foreach($items as $item){ echo "A"; var_dump($item) . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
before: array(2) { ["position"]=> string(1) "1" ["count"]=> int(4) } array(2) { ["position"]=> string(1) "2" ["count"]=> int(3) } modifying items... after: Aarray(2) { ["position"]=> string(1) "1" ["count"]=> int(8) } Aarray(2) { ["position"]=> string(1) "2" ["count"]=> int(6) }

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:
127.73 ms | 406 KiB | 5 Q