Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``abs`` |
2 | ======= | ||||
3 | |||||
4 | The ``abs`` filter returns the absolute value. | ||||
5 | |||||
6 | .. code-block:: twig | ||||
7 | |||||
8 | {# number = -5 #} | ||||
9 | |||||
10 | {{ number|abs }} | ||||
11 | |||||
12 | {# outputs 5 #} | ||||
13 | |||||
14 | .. note:: | ||||
15 | |||||
16 | Internally, Twig uses the PHP `abs`_ function. | ||||
17 | |||||
18 | .. _`abs`: https://secure.php.net/abs |