Im coding in twig to visualize values that I get from php and I want that the keyname of array appear above the values.
{% if user.address %}
<tr>
{% for address in user.address %}
{% for parts in address %}
<td width="25%">
{{ parts }}
</td>
{%endfor%}
{% endfor %}
</tr>
{% endif %}
{% for address in user.address %}
{{address.key}}
-address : array:4 [▼
"Door" => array:1 [▼
0 => "225"
]
"Street" => array:1 [▼
0 => "Pinky street"
]
"District" => array:1 [▼
0 => "District north"
]
"City" => array:1 [▼
0 => "New York"
]
]
{% if user.address %}
<tr>
{% for key, address in user.address %}
<td width="25%">
{{ key }}
</td>
{%endfor%}
</tr>
<tr>
{% for address in user.address %}
{% for parts in address %}
<td width="25%">
{{ parts }}
</td>
{%endfor%}
{%endfor%}
</tr>
{% endif %}
you can try this:
{% for key, address in user.address %}
In this way you have the key and the value