So you have an array chock full of numbers and you now need a total for those said numbers. Of course, you could always just do a foreach loop and simply add them all up, but a far simpler method would be to make use of PHP’s built in array summing function, the deftly named array_sum function.
Now this function is available in both PHP 4 (from 4.0.4 upwards) as well as PHP 5 and making use of it is as simple as calling array_sum ($input_array) where the result is a number (integer or float) and $input_array is the array that you wish to sum.
So in other words, pretty damn simple to use! :)
Related link: http://www.php.net/manual/en/function.array-sum.php