Smartyで数値を3桁毎にカンマで区切るには。


Smartyで通貨などの数値を出力する時に、

1,234,567

などとカンマをつけて出力したい時に一番簡単な方法は、PHPのnumber_format関数を使うことです。
SmartyはPHPの関数をそのまま修飾子に使えますので、
[smarty]
{$num|number_format}
[/smarty]
これでOKです!

関連する記事:

  1. I often visit your site and have noticed that you don’t update it often. More frequent
    updates will give your website higher rank & authority in google.
    I know that writing content takes a lot of time, but you can always help yourself with miftolo’s tools which will shorten the time of creating an article to a few seconds.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">