array(2)( [0] => array(5) { ["id"] => string(2) "11" ["name"] => string(5) "1.jpg" ["suffix"] => string(3) "jpg" ["url"] => string(29) "./Uploads/1/5292f55d208e8.jpg" ["size"] => string(6) "715895" } [1] => array(5) { ["id"] => string(2) "12" ["name"] => string(22) "minisite数据库.docx" ["suffix"] => string(4) "docx" ["url"] => string(30) "./Uploads/1/5292f5606a52c.docx" ["size"] => string(5) "16667" } )
//例子一
array(2) {
[0] => array(1) {
["money"] => string(4) "0.27"
}
[1] => array(1) {
["money"] => string(4) "0.42"
}
}
//例子二
计算size的和:
$sum = 0; foreach($arr as $item){ $sum += (int) $item['size']; }
例子一需要(int),例子二不需要