开发者

Formatting numbers with thousands separator Smarty PHP

开发者 https://www.devze.com 2023-01-06 04:02 出处:网络
Im trying to format numbers with thousands separator Smarty. So for example 1000 becomes 1,000. Than开发者_开发技巧ks.or you can use php function inside smarty, this is for number_format, you can us

Im trying to format numbers with thousands separator Smarty.

So for example 1000 becomes 1,000.

Than开发者_开发技巧ks.


or you can use php function inside smarty, this is for number_format, you can use other php function too :)

PHP : number_format($number, 2, '.', ',');

SMARTY :
{$number|number_format:2:".":","}


or just in smarty use {$var|number_format:0}


Try to use string_format, it uses sprintf to format your string.

0

精彩评论

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