开发者

How do I do number formatting using zend form

开发者 https://www.devze.com 2023-02-19 16:45 出处:网络
Hii... 开发者_如何学运维 I want to display decimal before last two digits of a number in zend_form, how can I do that? please suggest. Thanx.You can use Zend_Locale_Format to format numbers. In additi

Hii...

开发者_如何学运维

I want to display decimal before last two digits of a number in zend_form, how can I do that? please suggest. Thanx.


You can use Zend_Locale_Format to format numbers. In addition to standard formating (.e.g precission) you can form number according to your locale (.e.g. en, pl, de, etc.).


Just use number_format($value, 2)

or

echo substr($value, 0, strlen($value) - 2) , '.' , substr($value, -2);


As Marcin says, the best is to use Zend_Locale_Format as in documentation here: http://framework.zend.com/manual/fr/zend.locale.parsing.html

Zend_Locale_Format::getNumber($value);

Do not use directly number_format.

0

精彩评论

暂无评论...
验证码 换一张
取 消