title: php, 3 array to one array merge alternative
body: <p>I have 3 arrays. These inter-related. I want to combine these statements.</p>
  
  <pre><code>&lt;?php
  
  $post = array(   
      array (
          'id'      =&gt; 1,
          'title'   =&gt; 'Title 1',
          'content' =&gt; 'Content 1'
        ),
      array (
          'id'      =&gt; 2,
          'title'   =&gt; 'Title 2',
          'content' =&gt; 'Content 2'
        ),
      array (
          'id'      =&gt; 3,
          'title'   =&gt; 'Title 3',
          'content' =&gt; 'Content 3'
        ),
  );
  
  
  $user = array(   
      array (
          'id'   =&gt; 1,
          'name' =&gt; 'Mark'
        ),
      array (
          'id'   =&gt; 2,
          'name' =&gt; 'Selena'
        )
  );
  
  $post_user = array(   
      array (
          'id'      =&gt; 1,
          'post_id' =&gt; 1,
          'user_id' =&gt; 1
        ),
      array (
          'id'      =&gt; 2,
          'post_id' =&gt; 2,
          'user_id' =&gt; 1
        ),
      array (
          'id'      =&gt; 3,
          'post_id' =&gt; 3,
          'user_id' =&gt; 2
        ),
  );
  
  
  $merge = array();
  foreach($posts_user as $data){       
     foreach ($posts as $post){
         if($data['post_id'] == $post['id'] ){
             foreach ($users as $user){
                if($data['user_id'] == $user['id']){
                   $post['user'] = $user;
                   $merge['post'][] = $post;
                }
             }
         }
     }       
  }
  
  print_r($merge);
  </code></pre>
  
  <p>I want to be as follows. How can I do it?
  I want results.</p>
  
  <pre><code>$merge = array(   
      array (
          'id'      =&gt; 1,
          'title'   =&gt; 'Title 1',
          'content' =&gt; 'Content 1',
          'user'    =&gt; array (
                          'id' =&gt; '1',
                          'name' =&gt; 'Mark'
                      ),
  
        ),
      array (
          'id'      =&gt; 2,
          'title'   =&gt; 'Title 2',
          'content' =&gt; 'Content 2',
          'user'    =&gt; array (
                          'id' =&gt; '1',
                          'name' =&gt; 'Mark'
                      ),
        ),
      array (
          'id'      =&gt; 3,
          'title'   =&gt; 'Title 3',
          'content' =&gt; 'Content 3',
          'user'    =&gt; array (
                          'id' =&gt; '2',
                          'name' =&gt; 'Selena'
                      ),
        ),
  );
  </code></pre>
  
  <p>Is there another alternative? For example; How do I do with them?</p>
  
  <p><strong>array_walk_recursive(), ArrayIterator(), RecursiveArrayIterator()</strong></p>