system/classes/Collection.php
public function sumByKey($key = false)
    {
        $collection = $this->getIterator();
        $sum = 0;
        foreach ($collection as $result) {
            if ($key && isset($result->$key)) {
                $sum += $result->$key;
            }
            else if ($key && isset($result[$key])) {
                $sum += $result[$key];
            }
            else {
                $sum += $result;
            }
        }
        return $sum;
    }
public function sumByKey($key = false)
    {
        $collection = $this->getIterator();
        $sum = 0;
        foreach ($collection as $result) {
            if ($key && isset($result->$key)) {
                $sum += $result->$key;
            }
            else if ($key && isset($result[$key])) {
                $sum += $result[$key];
            }
            else {
                $sum += $result;
            }
        }
        return $sum;
    }
Returns the sum of the contents of the Container.
If given a key, will sum that $key->value.
Obviously it's important to have some consistency in the types of resources you
are storing or else the results might not make much sense or could crash.

@param key A key on which to sum the when looking at the contents of this Container.
@return A number.