PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Floating point value localization

toFloat() can localize floating point values. This function will return a localized string of the given number.

Example 572. Floating point value localization

<?php
$locale 
= new Zend_Locale('de_AT');
$number Zend_Locale_Format::toFloat(13547.3655,
                                      array(
'precision' => 1,
                                            
'locale' => $locale)
                                     );

// will return 13.547,4
print $number;

Zend Framework