• + 0 comments
    function miniMaxSum($arr) {
     sort($arr);
     $n = count($arr);
     
     $min = array_slice($arr, 0, $n - 1);
     $min_sum = array_sum($min);
     
     
     $max = array_slice($arr, 1);
     $max_sum = array_sum($max);
     
     echo $min_sum . ' '.$max_sum;
    }