public static function create($value, $symbol)
    {
        // Find the conversion factor to meters
        $factor = static::factorToMeters($symbol);

        // Ensure proper formatting of value and factor for bc math
        $value  = number_format($value, static::$s, '.', '');
        $factor = number_format($factor, static::$s, '.', '');

        // Convert to meters
        $meters = bcmul($value, $factor, static::$s);

        // Create new distance.
        $dist = new static($meters);
        $dist->format(static::FORMAT_DEFAULT . $symbol);

        return $dist;
    }
public static function create($value, $symbol)
    {
        // Find the conversion factor to meters
        $factor = static::factorToMeters($symbol);

        // Ensure proper formatting of value and factor for bc math
        $value  = number_format($value, static::$s, '.', '');
        $factor = number_format($factor, static::$s, '.', '');

        // Convert to meters
        $meters = bcmul($value, $factor, static::$s);

        // Create new distance.
        $dist = new static($meters);
        $dist->format(static::FORMAT_DEFAULT . $symbol);

        return $dist;
    }
public static function create ( $ value , $ symbol ) { // Find the conversion factor to meters $ factor = static :: factorToMeters ( $ symbol ) ; // Ensure proper formatting of value and factor for bc math $ value = number_format ( $ value , static :: $ s , '.' , '' ) ; $ factor = number_format ( $ factor , static :: $ s , '.' , '' ) ; // Convert to meters $ meters = bcmul ( $ value , $ factor , static :: $ s ) ; // Create new distance. $ dist = new static ( $ meters ) ; $ dist -> format ( static :: FORMAT_DEFAULT . $ symbol ) ; return $ dist ; }
Creates a new distance from a value and symbol.

@param double|string $value  Value of the distance
@param string        $symbol Symbol of the distance, e.g. m or km

@return static
Creates a new distance from a value and symbol .