public static function trim($n)
    {
        $float         = floatval($n);
        $decimalPlaces = 0;

        // If the number rounded to $decimalPlaces isn't equal to the float val, add another decimal place and try again
        while ($float != round($float, $decimalPlaces)) {
            $decimalPlaces++;
        }

        $decimalPlaces = ($decimalPlaces < 2) ? 2 : $decimalPlaces;

        return number_format($float, $decimalPlaces, ".", "");
    }