我有一个看起来像这样的多维数组:
Array
(
[0] => Array
(
[GB] => 20827
[US] => 73
[ES] => 23
[AU] => 15
[DE] => 12
[MY] => 4
[QA] => 1
[VN] => 1
[SK] => 1
[FJ] => 1
[ME] => 1
[TR] => 1
[LV] => 1
)
[1] => Array
(
[GB] => 15070
[US] => 3920
[IE] => 1711
[PH] => 1071
[MT] => 578
[AU] => 423
[HR] => 241
[ZA] => 210
[FR] => 139
)
)
我想用多维数组的每个数组中的所有关联元素创建一个新数组,并对重复键的值求和。
来自样本输入的期望结果:
array (
'GB' => 35897,
'US' => 3993,
'ES' => 23,
'AU' => 438,
'DE' => 12,
'MY' => 4,
'QA' => 1,
'VN' => 1,
'SK' => 1,
'FJ' => 1,
'ME' => 1,
'TR' => 1,
'LV' => 1,
'IE' => 1711,
'PH' => 1071,
'MT' => 578,
'HR' => 241,
'ZA' => 210,
'FR' => 139,
)