Prev | Current Page 334 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

637,34',
'locale' => $locale));
print $number; B
A German locale
B Prints the number ???3637.34???
We can then process the number as appropriate and may need to display a number to the user. In this case,
again we need to format the number appropriately for the user??™s location and we can use Zend_Locale??™s
toNumber() function as shown in listing 14.2..
Listing 14.2: Number localization with Zend_Locale
$locale = new Zend_Locale('de_DE'); A
$number = Zend_Locale_Format::toNumber(2435.837,
array('precision' => 2, B
'locale' => $locale));
print $number; C
A German locale
B Round to 2 decimal places
C Prints the number ???2.435,84???
The precision parameter is optional and is used to round the provided number to the given number of
decimal places. This covers the basics of what Zend_Locale can do with numbers. However, Zend_Locale
provides complete number handling though including translation of numbers between different numeral
systems, for example from Arabic to Latin. There is also support for integer and floating point number
normalization and localization. The manual gives full information on these functions.
Date and Time with Zend_Locale
Handling the formatting of dates and times is also within the province of Zend_Locale. This class operates in
conjunction with Zend_Date to provide comprehensive support for reading and writing dates.


Pages:
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
Potopek uchwyt lcd wyciągarki hotele londyn Wczasy nad morzem