title: Convert php array to table with twig
body: <p>Hi I need to build a table with twig from a php array, I would like to use the array keys as header for each column.</p>
  
  <p>this is the array</p>
  
  <pre><code>    Array ( 
       [0] =&gt; Array ( 
           [building_code] =&gt; 2C 
           [building_unit_id] =&gt; 57 
           [address] =&gt; Via monteverde 45 
           [name] =&gt; Andrea 
       ) 
       [1] =&gt; Array ( 
           [building_code] =&gt; 4E 
           [building_unit_id] =&gt; 55 
           [address] =&gt; Via monteverde 45 
           [name] =&gt; Andrea 
       ) 
      )
  </code></pre>
  
  <p><strong>This is what I've tried so far</strong></p>
  
  <pre><code>&lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
  
              {% for titolo in prova|keys %}
  
              &lt;th&gt;{{titolo}}&lt;/th&gt;
  
              {% endfor %}
  
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
  
          {% for sub_array in prova %}
          &lt;tr&gt;
              {% for value in sub_array %}
              &lt;td&gt;{{ value }}&lt;/th&gt;
                  {% endfor %}
          &lt;/tr&gt;
          {% endfor %}
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>This is the result</strong></p>
  
  <pre><code>0   1
  2C  57  Via monteverde 45   Andrea
  4E  55  Via monteverde 45   Andrea
  </code></pre>