I have an array in my controller. I pass this to my twig view along with another array one
user_id = Array ( [0] => abc [1] => Def [2] => Hij )
data = [0] => HelpCenterBundle\Entity\New Object
(
[id:HelpCenterBundle\Entity\New:private] => 5
[userId:HelpCenterBundle\Entity\New:private] => 314
[comment:HelpCenterBundle\Entity\New:private] => 1
)
I want to print it in a table.
{% for countlist in data %}
<tr>
<td>{{ countlist.id }}</td>
</tr>
<tr>
<td> here i want to print first element of user_count </td>
</tr>
{% endfor %}
I tried with a for loop like
{% for first in user_id %}
<td>{{ first }}</td>
But it results in all the contents in a same line. Please help
user_idarray? try with{{ user_id[0] }}otherwise try to made an example of what is your goal