Is it possible to format a number to 2 decimal places with Smarty PHP

plosww1 picture plosww1 · Mar 9, 2010 · Viewed 53.8k times · Source

Is it possible to format a number to 2 decimal places with Smarty PHP?

Thanks.

Answer

jasonbar picture jasonbar · Mar 9, 2010

string_format accepts sprintf formatting options:

{$number|string_format:"%.2f"}