Twig

The flexible, fast, and secure
template engine for PHP

a Symfony Product
Docs sequence
You are reading the documentation for Twig 3.x. Switch to the documentation for Twig 1.x. 2.x.

Questions & Feedback

License

Twig documentation is licensed under the new BSD license.

sequence

sequence checks if a variable is a sequence:

1
2
3
4
5
6
7
{% set users = ["Alice", "Bob"] %}
{# evaluates to true if the users variable is a sequence #}
{% if users is sequence %}
    {% for user in users %}
        Hello {{ user }}!
    {% endfor %}
{% endif %}