发布于 2015-10-07 09:50:57 | 127 次阅读 | 评论: 0 | 来源: 网络整理
Measurements can be output in a number of different ways.
Output with unit of measurement
Zend_Measure
supports outputting of strings automatically.
例 26.7. Automatic output
$locale = new Zend_Locale('de'); $mystring = "1.234.567,89 Meter"; $unit = new Zend_Measure_Length($mystring,Zend_Measure_Length::STANDARD, $locale); echo $unit;
The value of a measurement can be output using getValue()
.
例 26.8. Output a value
$locale = new Zend_Locale('de'); $mystring = "1.234.567,89 Meter"; $unit = new Zend_Measure_Length($mystring,Zend_Measure_Length::STANDARD, $locale); echo $unit->getValue();
The getValue()
method accepts an optional parameter 'round
' which allows to
define a precision for the generated output. The standard precision is '2
'.