Readie

msg:4090778 | 4:25 pm on Mar 3, 2010 (gmt 0) |
$total = 0; foreach($myArray as $value){ if(is_numeric($value)){ $total += $value; } } echo $total;
|
topr8

msg:4090785 | 4:28 pm on Mar 3, 2010 (gmt 0) |
$total=0; foreach($myArray as $key => $value){ $amount = $myArray[$key]; echo $amount; $total += $amount; } echo $total;
|
topr8

msg:4090787 | 4:29 pm on Mar 3, 2010 (gmt 0) |
:)
|
eelixduppy

msg:4090797 | 4:38 pm on Mar 3, 2010 (gmt 0) |
This can all be shortened to:
$total = array_sum($myArray); ;) [us.php.net...]
|
|