absΒΆ

The abs filter returns the absolute value.

{# number = -5 #}

{{ number|abs }}

{# outputs 5 #}

Note

Internally, Twig uses the PHP abs function.

Previous topic

Filters

Next topic

batch

This Page