title: Hierarchical Array Conversion to Flat Array
body: <p>I've got an array</p>
  
  <pre><code>$array = array(
      array(1,2,3),
      array('bob','bill'),
      array(4,5,6,7) 
      //can have between 0 and 5 "rows"
  );
  </code></pre>
  
  <p>I want to convert to an array that looks like this...</p>
  
  <pre><code>[1,bob,4, 1, bob, 5, 1, bob, 6, 1, bob, 7, 1, bill, 4 .... 3, bill, 7]
  </code></pre>
  
  <p>I was trying to write a recursive function for this which looks like... </p>
  
  <pre><code>function GetValues($array, $rowIndex, $valIndex, $values)
  {
      if(!isset($array[$rowIndex]))
      {
          return $values;
      }
      if(!isset($array[$rowIndex][$valIndex]))
      {
          return GetValues($array,$rowIndex+1, 0, $values);
      }
      $values[] = $array[$rowIndex][$valIndex];
  
      return  GetValues($array,$rowIndex, $valIndex+1, $values);
  }
  </code></pre>
  
  <p>which just ends up iterating the array normally (prints 1,2,3,bob,bill,4,5,6,7)</p>