开发者

How do I do number formatting using zend form

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜