src/Util/Arr.php
public static function median($arr)
    {
        $vals = array_values($arr);
        sort($vals);
        
        $num_vals = count($vals);
        return ($num_vals % 2)
            ? ($vals[$num_vals / 2] + $vals[($num_vals / 2) + 1]) / 2
            : $vals[($num_vals + 1) / 2];
    }
public static function median($arr)
    {
        $vals = array_values($arr);
        sort($vals);
        
        $num_vals = count($vals);
        return ($num_vals % 2)
            ? ($vals[$num_vals / 2] + $vals[($num_vals / 2) + 1]) / 2
            : $vals[($num_vals + 1) / 2];
    }
public static function median ( $ arr ) { $ vals = array_values ( $ arr ) ; sort ( $ vals ) ; $ num_vals = count ( $ vals ) ; return ( $ num_vals % 2 ) ? ( $ vals [ $ num_vals / 2 ] + $ vals [ ( $ num_vals / 2 ) + 1 ] ) / 2 : $ vals [ ( $ num_vals + 1 ) / 2 ] ; }
Get the median
@param array $arr
@return mixed
Get the median