plusMinus([-3, -5, 6, 7, 0, 0, 2, 4, -5, 3]);
//plusMinus([2 ,1,0, 0, 0, -6 ,-4, 10, 3, -7])."\n\n";
//plusMinus([1, 2, -6, -3, 8, 0 , 0, 1,-9, 4])."\n\n";
//calculate a ratio of positive, negative and 0 numbers in array
function plusMinus($arr){
$r=[0,0,0];
foreach ($arr as $item){
if ($item>0){
$r[0]++;
}else if ($item<0){
$r[1]++;
}else{
$r[2]++;
}
}
//number of items in entire array
$s = count($arr);
// Calculates each ratio and rounds the result to 6 digits
$res = [round($r[0]/$s, 6), round($r[1]/$s, 6), round($r[2]/$s, 6)];
echo $res[0] . "\n";
echo $res[1] . "\n";
echo $res[2] . "\n";
}