Search code examples
smarty

smarty string_format doesn't round up


Based on the documentation of string_format

This:

{$testy = 16.99}{$testy|string_format:'%d'}

Should output 17 but it gives me 16 instead

Anyone knows how to fix it?


Solution

  • I think there is an error in the new documentation. If you look at the old version it is correct.

    In cases you need 17 I recommend this:

    {$testy|ceil|string_format:"%d"}