title: Flatten multidimensional array concatenating keys
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1882894/php-convert-nested-array-to-single-array-while-concatenating-keys">PHP convert nested array to single array while concatenating keys?</a><br>
    <a href="https://stackoverflow.com/questions/2749398/get-arrays-key-recursively-and-create-underscore-seperated-string">Get array&#39;s key recursively and create underscore seperated string</a>  </p>
  </blockquote>
  
  
  
  <p>Please, read the whole question before answering.</p>
  
  <p>I have this multidimensional array:</p>
  
  <pre><code>$data = array(
      'user' =&gt; array(
          'email'   =&gt; 'user@example.com',
          'name'    =&gt; 'Super User',
          'address' =&gt; array(
              'billing' =&gt; 'Street 1',
              'delivery' =&gt; 'Street 2'
          )
      ),
      'post' =&gt; 'Hello, World!'
  );
  </code></pre>
  
  <p>I want it flatten, transformed into:</p>
  
  <pre><code>$data = array(
      'user.email' =&gt; 'user@example.com',
      'user.name'  =&gt; 'Super User',
      'user.address.billing'  =&gt; 'Street 1',
      'user.address.delivery' =&gt; 'Street 2',
      'post'       =&gt; 'Hello, World!'
  );
  </code></pre>
  
  <p><strong>Important</strong>:</p>
  
  <ul>
  <li><p>The keys are <strong>very</strong> important to me. I want them concatenated, separated by periods.</p></li>
  <li><p>It should work with any level of nesting.</p></li>
  </ul>
  
  <p>Thank you!</p>