keys
The keys
filter returns the keys of an array. It is useful when you want to
iterate over the keys of an array:
1 2 3
{% for key in array|keys %}
...
{% endfor %}
Note
Internally, Twig uses the PHP array_keys function.
keys
The keys
filter returns the keys of an array. It is useful when you want to
iterate over the keys of an array:
1 2 3
{% for key in array|keys %}
...
{% endfor %}
Note
Internally, Twig uses the PHP array_keys function.