title: PHP, recursive extract of all arrays in multidimensional array to one flat "holder" array?
body: <p>I have a messy tree multidimensional array that I want to do the following to:</p>
  
  <p>Extract each array, no matter how far nested down to put it into a single "holder array", so this (just a basic example as it would be much more complex than this as far as the nesting)</p>
  
  <pre><code>$this = array[0]=&gt; (array[1]=&gt;('a','b'),
                      array[2]=&gt;(array[3]=&gt;('c','d')));
  </code></pre>
  
  <p>would become something like this, it doesn't matter if it changes the index for each array, just so that they are still in an array, but "flat" so the only nesting is within the one main holder array</p>
  
  <pre><code>$would_become = array[holder]=&gt;(array[1]=&gt;('a','b'),
                                  array[2]=&gt;(),
                                  array[3]=&gt;('c','d'));
  </code></pre>
  
  <p>The overall reasoning behind this is that I have a bunch of nested arrays that have a common key, such as ['filepath'] and I want to be able to do something like below (would need to make it go through each array in the holder array obviously, but this shows the basic idea behind why i need this.</p>
  
  <pre><code>foreach ($holder_array as $holder_array) {
  
  // as an example:
  echo $holder_array['Path']
  }
  </code></pre>