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, ]; var_export( array_reduce( array_keys($a2), function ($result, $k) use ($a2) { $result[$k] = ($result[$k] ?? 0) + $a2[$k]; return $result; }, $a1 ) );
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:
58.16 ms | 987 KiB | 4 Q