public static function percentage($total, $actual, $round = 1)
    {
        // Avoid useless calculations
        if ($total == 0 || $actual == 0) {
            return 0;
        }

        $value = 100 * $actual / $total;

        if (is_integer($round)) {
            $value = round($value, $round);
        }

        return $value;
    }
public static function percentage($total, $actual, $round = 1)
    {
        // Avoid useless calculations
        if ($total == 0 || $actual == 0) {
            return 0;
        }

        $value = 100 * $actual / $total;

        if (is_integer($round)) {
            $value = round($value, $round);
        }

        return $value;
    }
public static function percentage ( $ total , $ actual , $ round = 1 ) { // Avoid useless calculations if ( $ total == 0 || $ actual == 0 ) { return 0 ; } $ value = 100 * $ actual / $ total ; if ( is_integer ( $ round ) ) { $ value = round ( $ value , $ round ) ; } return $ value ; }
Counts a percentage

@param float|integer $total
@param float|integer $actual
@param integer $round
@return mixed
Counts a percentage