<?php
$arr = [
[[58 => 32]],
[[58 => 34]],
[[57 => 26]],
[[57 => 27]],
[[56 => 16]],
[[56 => 17]]
];
array_walk_recursive($arr, function($v,$k) use (&$r){
$r[$k] = isset($r[$k]) ? ($r[$k]+$v) : $v;
});
print_r($r);
- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- Array
(
[58] => 66
[57] => 53
[56] => 33
)
preferences:
90.66 ms | 407 KiB | 5 Q