A var_dump for my array $strs[$key][$id] gives the following result:
array(2) {
[0]=> array(4) {
[8259]=> string(8260) "ouvrir 1"
[8260]=> string(8261) "fichier 2"
[8261]=> string(8262) "quitter 1"
[8262]=> string(8263) "lire 2"
}
[1]=> array(4) {
[8259]=> string(8260) "lancer 2"
[8260]=> string(8261) "dossier 1"
[8261]=> string(8262) "exit 1"
[8262]=> string(8263) "lire 2"
}
}
In my view, I'm tying to get all the strings with the same $id from all the $key. Something like this:
1-
ouvrir 1
lancer 2
2-
fichier 2
lancer 2
etc
I've tried this in my twig view:
{% for key,val in strs['key']['id'] %}
{% if strs['key']['id'] is defined %}
{{ key }} - <br/>
{{ val }}
{% endif %}
{% endfor %}
I got this error:
Key "key" for array with keys "0, 1" does not exist in...
What Am I doing wrong here? And how can I get the result I'm looking for?