Mediana PHP

function median($a) { 
    sort($a);
    $c = count($a);
    $m = floor(($c-1)/2);
    return ($c % 2) ? $a[$m] : (($a[$m]+$a[$m+1])/2);
}
echo median([1,6,4,2,4,6,10,12,19]); //6
Friendly Hawk