blob: 44c3acf44cbc182f7612c5aeb7534bfb2396f71b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# number_format
Allows you to format a number using decimals and a thousands-separator. By default, the number of decimals is 0
and the number is rounded.
## Basic usage
```smarty
{$num = 2000.151}
{$num|number_format} # renders: 2,000
```
## Parameters
| Parameter | Type | Required | Description |
|-----------|--------|----------|---------------------------------------|
| 1 | int | No | number of decimals (defaults to 0) |
| 2 | string | No | decimal separator (defaults to ".") |
| 3 | string | No | thousands-separator (defaults to ",") |
## Examples
```smarty
{$num = 2000.151}
{$num|number_format:2} # renders: 2,000.15
```
```smarty
{$num = 2000.151}
{$num|number_format:2:".":""} # renders: 2000.15
```
|