Jak wyświetlić liczbę po przecinku w smarty: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
m |
|||
| Linia 1: | Linia 1: | ||
string_format | '''string_format''' | ||
<pre> | <pre> | ||
Wersja z 19:27, 29 lut 2012
string_format
<?php
$smarty->assign('number', 23.5787446);
?>
Where template is:
{$number}
{$number|string_format:"%.2f"}
{$number|string_format:"%d"}
Will output:
23.5787446 23.58 24