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));
posted @ 2015-12-30 09:51  会飞的鱼001  阅读(434)  评论(0编辑  收藏  举报