测试版本 -- 正常无报错
$num_sum = array_sum(array_column($store, 'shuliang'));
正式版本太低 不支持 array_column 重写方法
$sum_num = array_sum($this->array_column($store,'shuliang'));
function array_column(array &$rows, $column_key, $index_key = null) {
$data = array();
if (empty($index_key)) {
foreach ($rows as $row) {
$data[] = $row[$column_key];
}
} else {
foreach ($rows as $row) {
$data[$row[$index_key]] = $row[$column_key];
}
}
return $data;
}
标签:column,sum,--,key,array,data,row
From: https://www.cnblogs.com/depressiom/p/16894937.html