• + 0 comments

    pretty cool!, a little more readable for me:

    $res = array_reduce($arr, function($carry, $val) {

    ($val>0 and carry[0]++) or ($val<0 and $carry[1]++) or (!val and $carry[2]++); return $carry;},[]);

    printf ("%f\n%f\n%f", $res[0]/$n, $res[1]/$n, `$res[2]/$``n);