function sum($array) { if (count($array) == 1) { return $array[0]; } $firstNum = array_shift($array); return $firstNum + sum($array);}