I have a weird problem with twig in Symfony2. I am using the following array:
[days] => Array
(
[1] => Array
(
[money] => 9
)
[2] => Array
(
[money] => 21
)
[3] => Array
(
[money] => 38
)
[4] => Array
(
[money] => 6
)
[18] => Array
(
[money] => 6
)
[19] => Array
(
[money] => 3
)
[31] => Array
(
[money] => 11
)
)
to test this I used the following code
{% for key in days %}
{{ key }}<br>
{% endfor %}
but the output shows the following
0
1
2
3
4
5
6
but it should look like this
1
2
3
4
18
19
31
Looks like twig creates a new array with new indexes. Is there a way to get the right index from array?
With var_dump($days)
in php I can see the right index, so the "problem" is related to twig.