Array
(
[balance] => Array
(
[0] => Array
(
[id] => 1
[balance] => 10
)
[1] => Array
(
[id] => 1
[balance] => 30
)
[2] => Array
(
[id] => 1
[balance] => 50
)
)
)
Array
(
[id] => 1
[balnce] => 90
)
$res = array_reduce (
$data['balance'],
function($res, $el) {
if (isset($res[$el['id']])) $res[$el['id']] += $el['balance'];
else $res[$el['id']] = $el['balance'];
return $res;
},
[]
);