public static function trim($number)
    {
        if (strpos($number, '.') != false) {
            // The number is decimal, strip trailing zeroes.
            // If no digits remain after the decimal point, strip it as well.
            $number = rtrim($number, '0');
            $number = rtrim($number, '.');
        }

        return $number;
    }
public static function trim($number)
    {
        if (strpos($number, '.') != false) {
            // The number is decimal, strip trailing zeroes.
            // If no digits remain after the decimal point, strip it as well.
            $number = rtrim($number, '0');
            $number = rtrim($number, '.');
        }

        return $number;
    }
public static function trim ( $ number ) { if ( strpos ( $ number , '.' ) != false ) { // The number is decimal, strip trailing zeroes. // If no digits remain after the decimal point, strip it as well. $ number = rtrim ( $ number , '0' ) ; $ number = rtrim ( $ number , '.' ) ; } return $ number ; }
Trims the given number.

By default bcmath returns numbers with the number of digits according
to $scale. This means that bcadd('2', '2', 6) will return '4.00000'.
Trimming the number removes the excess zeroes.

@param string $number The number to trim.

@return string The trimmed number.
Trims the given number .