3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array("x1" => 1, "x2" => 3, "y5" => 9), array("x1" => 3, "x4" => 1, "y5" => 1), array("x1" => 1, "x8" => 5, "a5" => 2), array("x1" => 2, "x10" => 3, "b5" => 5) ); $keys = []; foreach($array as $subarr){ $keys = array_merge($keys, array_keys($subarr)); } foreach(array_unique($keys) as $item){ $res[$item] = array_sum(array_column($array, $item)); } var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
array(8) { ["x1"]=> int(7) ["x2"]=> int(3) ["y5"]=> int(10) ["x4"]=> int(1) ["x8"]=> int(5) ["a5"]=> int(2) ["x10"]=> int(3) ["b5"]=> int(5) }

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