$array = array(array(1,2),array(3,4)); $count = 0; foreach($array as $key=>$value){ $count += array_sum($value); } echo $count;
array_sum() 函数返回数组中所有值的和
<?php $a=array(5,15,25); echo array_sum($a); ?>
$array = array(array(1,2),array(3,4)); $count = 0; foreach($array as $key=>$value){ $count += array_sum($value); } echo $count;
array_sum() 函数返回数组中所有值的和
<?php $a=array(5,15,25); echo array_sum($a); ?>