Get a Demo
Table of contents

length Twig Filter

The length filter returns the number of items of a sequence or mapping or the length of a string.

Examples Link

Outputting the length.

{{ variable|length }}

Using the length in a test.

{% if variable|length > 0 %}
...
{% endif %}
Get Started With Aptuitiv