3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = "unchecked"; $a = array(1, 2, 3, "is_ref" => &$x); foreach ($a as $k => $v) { if ($k !== "is_ref") { /* CODE FOR TESTING HERE */ // This will cause a copy: //$a[$k] = null; //$v += 1; //$a[$k] = $v; // This won't: //var_dump($a); } else if (isset($x)) { $x = "was not copied"; unset($x); $tmp = $a; $tmp["is_ref"] = "WAS COPIED!!!"; unset($tmp); echo "######### \$a ".$a["is_ref"]."\n"; } }
Output for git.master, git.master_jit, rfc.property-hooks
######### $a was not copied

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