3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a1 = [ "a" => 2, "b" => 0, "c" => 5, ]; $a2 = [ "a" => 3, "b" => 9, "c" => 7, "d" => 10, ]; $result = $a1; foreach ($a2 as $k => $v) { $result[$k] = ($result[$k] ?? 0) + $v; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'a' => 5, 'b' => 9, 'c' => 12, 'd' => 10, )

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:
39.9 ms | 1002 KiB | 4 Q