Format.number ViewHelper <f:format.number>

Formats a number with custom precision, decimal point and grouped thousands. See https://www.php.net/manual/function.number-format.php.

Examples

Defaults

<f:format.number>423423.234</f:format.number>
Copied!

423,423.20

With all parameters

<f:format.number decimals="1" decimalSeparator="," thousandsSeparator=".">
    423423.234
</f:format.number>
Copied!

423.423,2

Source code

Go to the source code of this ViewHelper: Format\NumberViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.number ViewHelper:

decimalSeparator

decimalSeparator
Type
string
Default
'.'
The decimal point character

decimals

decimals
Type
int
Default
2
The number of digits after the decimal point

thousandsSeparator

thousandsSeparator
Type
string
Default
','
The character for grouping the thousand digits