<?php
$a = array(
array(
'week' => 26,
'#orders_CA' => 0,
'cost_CA' => 0,
'#orders_US' => 3,
'cost_US' => 18.99,
'#orders_INTERNATIONAL' => 0,
'cost_INTERNATIONAL' => 0
),
array(
'week' => 26,
'#orders_CA' => 0,
'cost_CA' => 0,
'#orders_US' => 0,
'cost_US' => 0,
'#orders_INTERNATIONAL' => 22,
'cost_INTERNATIONAL' => 32
),
);
$keys = array_keys($a);
$res = call_user_func_array('array_map', array_merge(array(function() {
return array_sum(func_get_args());
}), $a));
print_r($res);
print_r(array_combine($keys, $res));
preferences:
45.93 ms | 402 KiB | 5 Q