Link to home
Start Free TrialLog in
Avatar of anotherdotcommer
anotherdotcommer

asked on

How do you sum up an array?

I have an array that I would like to sum up i.e. I have the array $price[$j][4] and I would like all the results of that array added together and have a total. I hope that makes sense.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

array_sum() maybe?  Please post a small test data set and I will show you how I would do it.
Avatar of anotherdotcommer
anotherdotcommer

ASKER

Thanks Ray! Here is what I was trying. The page wouldn't load though.... <?php for ($j=0; $j<($price); $j++) {

echo ''.array_sum($price[$j][4]).''; }?>
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It worked!! Thanks
Glad to help!