/home/techb158/exp.abdallabala.com/application/autoload/Ib
Edit: /home/techb158/exp.abdallabala.com/application/autoload/Ib/Math.php (813B)
$val,
'avg' => round(($val / $num) * 100, $round),
];
}, array_count_values($array));
}
public static function array_percentage($arr, $round = 1)
{
$total = array_sum($arr);
$ret = [];
foreach ($arr as $key => $value) {
if ($value == 0) {
$ret[$key]['percentage'] = 0;
} else {
$ret[$key]['percentage'] = round(
($value / $total) * 100,
$round
);
}
}
return $ret;
}
}