src/classes/CCArr.php
public static function sum( $arr, $key = null ) 
	{	
		if( !is_array( $arr ) ) 
		{
			throw new \InvalidArgumentException('CCArr::sum - first argument has to be an array.');
		}

		$sum = 0;

		if ( is_string( $key ) && CCArr::is_multi( $arr ) ) 
		{
			$arr = CCArr::pick( $key, $arr );
		}

		foreach ( $arr as $item ) 
		{
			if ( is_numeric( $item ) ) 
			{
				$sum += $item;	
			}
		}

		return $sum;
	}
public static function sum( $arr, $key = null ) 
	{	
		if( !is_array( $arr ) ) 
		{
			throw new \InvalidArgumentException('CCArr::sum - first argument has to be an array.');
		}

		$sum = 0;

		if ( is_string( $key ) && CCArr::is_multi( $arr ) ) 
		{
			$arr = CCArr::pick( $key, $arr );
		}

		foreach ( $arr as $item ) 
		{
			if ( is_numeric( $item ) ) 
			{
				$sum += $item;	
			}
		}

		return $sum;
	}
public static function sum ( $ arr , $ key = null ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'CCArr::sum - first argument has to be an array.' ) ; } $ sum = 0 ; if ( is_string ( $ key ) && CCArr :: is_multi ( $ arr ) ) { $ arr = CCArr :: pick ( $ key , $ arr ) ; } foreach ( $ arr as $ item ) { if ( is_numeric ( $ item ) ) { $ sum += $ item ; } } return $ sum ; }
sum items in an array or use special item in the array

@param array[array]	$arr
@param string			$key
sum items in an array or use special item in the array