Probably the most important feature is the conversion into different units of
measurement. The conversion of a unit can be done any number of times using the method
convertTo(). Units of measurement can only be converted to
other units of the same type (class). Therefore, it is not possible to convert (e.g.) a
length into a weight, which would might encourage poor programming practices and allow
errors to propagate without exceptions.
convertTo() method accepts an optional parameter. With
this parameter you can define an precision for the returned output. The standard
precision is '2'.
Example 597. Convert
$locale = new Zend_Locale('de');
$mystring = "1.234.567,89";
$unit = new Zend_Measure_Weight($mystring,'POND', $locale);
// constants are considered "better practice" than strings
// define a precision for the output
print "Ton:".$unit->convertTo(Zend_Measure_Weight::TON, 3);