1. public function calculatePercent($number, $total)
    2. {
    3. if ($number == 0 || $total == 0) {
    4. return '0%';
    5. }
    6. if ($number >= $total) {
    7. return '100%';
    8. }
    9. return intval($number / $total * 100).'%';
    10. }