public function unit($symbol, $string = false)
    {
        // Format instance's meter value and factor to the specified unit.
        $m    = number_format($this->m, static::$s, '.', '');
        $fact = number_format(static::factorToMeters($symbol), static::$s, '.',
          '');

        // Divide the meters by the factor and trim end of zeros
        $unit = bcdiv($m, $fact, static::$s);
        $unit = static::removeTrailingZeros($unit);

        // Return rounded double value, or string value.
        return $string ? $unit : round($unit, 20);
    }
public function unit($symbol, $string = false)
    {
        // Format instance's meter value and factor to the specified unit.
        $m    = number_format($this->m, static::$s, '.', '');
        $fact = number_format(static::factorToMeters($symbol), static::$s, '.',
          '');

        // Divide the meters by the factor and trim end of zeros
        $unit = bcdiv($m, $fact, static::$s);
        $unit = static::removeTrailingZeros($unit);

        // Return rounded double value, or string value.
        return $string ? $unit : round($unit, 20);
    }
public function unit ( $ symbol , $ string = false ) { // Format instance's meter value and factor to the specified unit. $ m = number_format ( $ this -> m , static :: $ s , '.' , '' ) ; $ fact = number_format ( static :: factorToMeters ( $ symbol ) , static :: $ s , '.' , '' ) ; // Divide the meters by the factor and trim end of zeros $ unit = bcdiv ( $ m , $ fact , static :: $ s ) ; $ unit = static :: removeTrailingZeros ( $ unit ) ; // Return rounded double value, or string value. return $ string ? $ unit : round ( $ unit , 20 ) ; }
Returns the value of this instance at the specified unit optionally as
a string with higher precision.

@param string $symbol Symbol of the unit to obtain
@param bool   $string True to return as string, false for double

@return double|string
Returns the value of this instance at the specified unit optionally as a string with higher precision .