3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('aa'=>10, 'bb'=>2, 'cc'=>5); $b = array('aa'=>1, 'bb'=>20, 'dd'=>11); $c = array('aa'=>3); $d = array('ee'=>5); $arr = [$a,$b,$c,$d]; $keys = array_keys(array_merge($a,$b,$c,$d)); Foreach($keys as $key){ $sums[$key] = array_sum(array_column($arr, $key)); } Var_dump($sums);
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { ["aa"]=> int(14) ["bb"]=> int(22) ["cc"]=> int(5) ["dd"]=> int(11) ["ee"]=> 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:
100.63 ms | 405 KiB | 5 Q