title: Is there a way to loop through a multidimensional array without knowing it's depth?
body: <p>So far, if I have to loop through a multidimensional array, I use a foreach loop for each dimension.</p>
  
  <p>e.g for two dimensions</p>
  
  <pre><code>foreach($array as $key=&gt;$value)
  {
      foreach($value as $k2=&gt;$v2)
      {
           echo
      }
  }
  </code></pre>
  
  <p>What do I do when I don't know the depth of the array? ie the depth is variable.</p>
  
  <p>The only thing I can think of is to code a whole stack of loops and to break the loop if the next value is not an array.This seems a little silly.</p>
  
  <p>Is there a better way?</p>