foreach loop twig code example
Example 1: twig foreach
{% for key, value in array %}
{{ key }}: {{ value }}
{% endfor %}
Example 2: foreach twig
{% for user in users %}
<li>{{ user.username|e }}</li>
{% endfor %}
{% for key, value in array %}
{{ key }}: {{ value }}
{% endfor %}
{% for user in users %}
<li>{{ user.username|e }}</li>
{% endfor %}