10 lines
211 B
PHP
10 lines
211 B
PHP
<?php function percentage($number, $max, $fixed = 2) {
|
|
|
|
try {
|
|
$percent = round($number * 100 / $max, $fixed);
|
|
} catch (\Throwable $th) {
|
|
$percent = 0;
|
|
}
|
|
|
|
return $percent;
|
|
} ?>
|