$arr = [
[
"id" =>"11",
"money" => "111",
],
[
"id" => "12",
"money" => "222",
]
];
我要计算money的和
(1)
echo array_sum(array_map(create_function('$val', 'return $val["money"];'), $arr));
或者
echo array_sum(array_map(function($val){return $val['money'];}, $arr));
(2)
$sum = 0;
foreach($arr as $item){
$sum += (int) $item['money'];
}
(3)
array_sum(array_column($arr,'money'));