/** * Calculates the sum of squares. Essentially pythagoras without the sqrt * * @param number|array $arg[0] * @param number|array $arg[1] * ...... * * @return float */ public static function sumOfSquares() { $args = func_get_args(); $total = 0; foreach ($args as $arg) { if (is_array($arg)) { //if item is an array recursively sum all values in array $total += Math::squareAndSum($arg); } else { $total += $arg * $arg; } } return $total; }