php中计算二维数组中某一元素之和
$arr
=array(
[0] => array(5) { ["id"] => string(2) "11" ["name"] => string(5) "张三" ["size"] => string(6) "715895" } [1] => array(5) { ["id"] => string(2) "12" ["name"] => string(22) "李四" ["size"] => string(5) "16667" }
)
echo
array_sum
(
array_map
(
function
(
$val
){
return
$val
[
'size'
];},
$arr
));