twig foreach key value
{% for key, user in users %}
<li>{{ key }}: {{ user.username }}</li>
{% endfor %}
twig foreach key value
{% for key, user in users %}
<li>{{ key }}: {{ user.username }}</li>
{% endfor %}
twig loop
loop.index The current iteration of the loop. (1 indexed)
loop.index0 The current iteration of the loop. (0 indexed)
loop.revindex The number of iterations from the end of the loop (1 indexed)
loop.revindex0 The number of iterations from the end of the loop (0 indexed)
loop.first True if first iteration
loop.last True if last iteration
loop.length The number of items in the sequence
loop.parent The parent context
{% for user in users %}
{{ loop.index }} - {{ user.username }}
{% endfor %}
twig for loop key
{% for key, user in users %}
<li>{{ key }}: {{ user.username|e }}</li>
{% endfor %}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us