private static function removeTrailingZeros($num)
    {
        // Only do this if number has a decimal value.
        if (strstr($num, '.')) {
            $num  = rtrim($num, '0');
            $last = substr($num, strlen($num) - 1, 1) == '.';
            $num  = $last ? substr($num, 0, strlen($num) - 1) : $num;

            return $num;
        } else {
            // No decimal value, don't modify number
            return $num;
        }
    }
private static function removeTrailingZeros($num)
    {
        // Only do this if number has a decimal value.
        if (strstr($num, '.')) {
            $num  = rtrim($num, '0');
            $last = substr($num, strlen($num) - 1, 1) == '.';
            $num  = $last ? substr($num, 0, strlen($num) - 1) : $num;

            return $num;
        } else {
            // No decimal value, don't modify number
            return $num;
        }
    }
private static function removeTrailingZeros ( $ num ) { // Only do this if number has a decimal value. if ( strstr ( $ num , '.' ) ) { $ num = rtrim ( $ num , '0' ) ; $ last = substr ( $ num , strlen ( $ num ) - 1 , 1 ) == '.' ; $ num = $ last ? substr ( $ num , 0 , strlen ( $ num ) - 1 ) : $ num ; return $ num ; } else { // No decimal value, don't modify number return $ num ; } }
Removes trailing zeros for a numeric value expressed as a string.

@param $num

@return string
Removes trailing zeros for a numeric value expressed as a string .