Round ViewHelper <f:round>
The RoundViewHelper rounds a float value with the specified precision and rounding mode.
The ViewHelper mimics PHP's
round function.
| rounding modes | PHP < 8.4 | PHP >= 8.4 |
|---|---|---|
| HalfAwayFromZero | Yes | Yes |
| HalfTowardsZero | Yes | Yes |
| HalfEven | Yes | Yes |
| HalfOdd | Yes | Yes |
| TowardsZero | No | Yes |
| AwayFromZero | No | Yes |
| NegativeInfinity | No | Yes |
| PositiveInfinity | No | Yes |
Go to the source code of this ViewHelper: RoundViewHelper.php (GitHub).
Arguments of the <f:round> ViewHelper
precision
-
- Type
- int
- Default
- 2
Rounding precision
roundingMode
-
- Type
- string
- Default
- 'HalfAwayFromZero'
Rounding mode
value
-
- Type
- float
The number that should be rounded