title: PHP Looping through array recursive
body: <p>I want to loop through an array in PHP. The loop must be recursive, because I don't now how many arrays-in-arrays there are. It is for reading translations in Symfony2.</p>
  
  <p>The output format is: </p>
  
  <pre><code>a.d.e
  a.f.g
  b.h.i
  c.j.k.l.m
  c.n.o
  </code></pre>
  
  <p>with example array:</p>
  
  <pre><code>$array = array(
      'a' =&gt; array('d' =&gt; 'e', 'f' =&gt; 'g'),
      'b' =&gt; array('h' =&gt; 'i'),
      'c' =&gt; array(
          'j' =&gt; array(
              'k' =&gt; array(
                  'l' =&gt; 'm')),
          'n' =&gt; 'o'));
  </code></pre>
  
  <p>I have tried the following, but this is not a final solution, but the recursion is working:</p>
  
  <pre><code>function displayArrayRecursively($array)
  {
      foreach ($array as $key =&gt; $value) {
  
          if (is_array($value)) {
              echo $key . '&lt;br&gt;';
              displayArrayRecursively($value);
          } else {
  
              echo $key . '&lt;br&gt;' . $value . '&lt;br&gt;';       
          }
      }
  }
  </code></pre>
  
  <p>Thanks in advance!</p>