title: Extract data from nested arrays
body: <p>I have the following array (via <code>var_dump</code>) <code>$results</code>:</p>
  
  <pre><code>array(4) { 
      [0]=&gt; array(5) { 
          [0]=&gt; array(1) { ["evtId"]=&gt; string(1) "2" } 
          [1]=&gt; array(1) { ["evtId"]=&gt; string(1) "3" } 
          [2]=&gt; array(1) { ["evtId"]=&gt; string(1) "4" } 
          [3]=&gt; array(1) { ["evtId"]=&gt; string(1) "5" } 
          [4]=&gt; array(1) { ["evtId"]=&gt; string(1) "6" } 
      [1]=&gt; array(5) { 
          [0]=&gt; array(1) { ["evtLocation"]=&gt; string(2) "11 St Paul" } 
          [1]=&gt; array(1) { ["evtLocation"]=&gt; string(5) "12412 Horace St" } 
          [2]=&gt; array(1) { ["evtLocation"]=&gt; string(14) "Friends Center" } 
          [3]=&gt; array(1) { ["evtLocation"]=&gt; string(14) "Friends Center" } 
          [4]=&gt; array(1) { ["evtLocation"]=&gt; string(14) "Friends Center" } 
      [2]=&gt; array(5) { 
          [0]=&gt; array(1) { ["evtDate"]=&gt; string(1) "11/12/2011" } 
          [1]=&gt; array(1) { ["evtDate"]=&gt; string(1) "06/05/2012" } 
          [2]=&gt; array(1) { ["evtDate"]=&gt; string(1) "10/10/2010" } 
          [3]=&gt; array(1) { ["evtDate"]=&gt; string(1) "06/06/2012" } 
          [4]=&gt; array(1) { ["evtDate"]=&gt; string(1) "10/12/2012" } 
      [3]=&gt; array(5) { 
          [0]=&gt; array(1) { ["evtType"]=&gt; string(4) "Fun" } 
          [1]=&gt; array(1) { ["evtType"]=&gt; string(6) "Random" } 
          [2]=&gt; array(1) { ["evtType"]=&gt; string(9) "Childcare" } 
          [3]=&gt; array(1) { ["evtType"]=&gt; string(9) "Childcare" } 
          [4]=&gt; array(1) { ["evtType"]=&gt; string(9) "Childcare" } 
  </code></pre>
  
  <p>I'm using this array to pull database information into a function that builds a table. However, I need this to end up in the following format:</p>
  
  <pre><code>$rows[] = array('2', '11 St Paul', '11/12/2011', 'Fun'); 
  </code></pre>
  
  <p>I've really only been able to get this far:</p>
  
  <pre><code>foreach ($events as $field_arr) {
    //this gives me 4 arrays, each array containing all of the records for one field type.
  }
  </code></pre>
  
  <p>Now I need to loop through each of the four arrays, take one value from the same index and add it to the <code>$rows[]</code> array, which I can pass to the table building function. I've tried variations of the following (inside the initial foreach loop)</p>
  
  <pre><code> $x = count($result[0]); //this gives the number of fields
   for ($i = 0; $i &lt; $x; $i++) {
      rows[$i] = $field_array[$i];
   }
  </code></pre>
  
  <p>I've been trying variations for half the day, with little luck (I'm ending up with arrays containing 4 times as many elements as I need, and having a hard time getting rid of the final array keys (<code>['evtType']</code> etc).
  If anyone can help point me in the right direction I'd greatly appreciate it.</p>