title: How can I merge an array into the child level of another array (recursively)?
body: <p>array1:</p>
  
  <pre><code>array(1) {
    [0]=&gt;
    array(2) {
      ["1234"]=&gt;
      array(1) {
        ["fileName"]=&gt;
        string(10) "monkey.jpg"
      }
      ["3456"]=&gt;
      array(1) {
        ["fileName"]=&gt;
        string(9) "horse.jpg"
  
      }
    }
  }
  </code></pre>
  
  <p>array2:</p>
  
  <pre><code>array(2) {
    ["number"]=&gt;
    string(2) "62"
    ["company"]=&gt;
    string(7) "animals"
  }
  </code></pre>
  
  <p>I want to merge the two arrays together:</p>
  
  <pre><code>$result = array_merge_recursive($array1,$array2);
  </code></pre>
  
  <p>This is the result:</p>
  
  <pre><code>array(3) {
    [0]=&gt;
    array(2) {
      ["1234"]=&gt;
          array(1) {
            ["fileName"]=&gt;
            string(10) "monkey.jpg"
          }
       ["3456"]=&gt;
          array(1) {
            ["fileName"]=&gt;
            string(9) "horse.jpg"   
       }
    }
    ["number"]=&gt;
    string(2) "62"
    ["company"]=&gt;
    string(7) "animals"
  }
  </code></pre>
  
  <p>But the result I would actually need is this:</p>
  
  <pre><code>array(1) {
    [0]=&gt;
    array(4) {
       ["1234"]=&gt;
            array(1) {
           ["fileName"]=&gt;
            string(10) "monkey.jpg"
           }
        ["3456"]=&gt;
           array(1) {
              ["fileName"]=&gt;
             string(9) "horse.jpg"   
           }
        ["number"]=&gt;
        string(2) "62"
        ["company"]=&gt;
        string(7) "animals"
    }
  }
  </code></pre>
  
  <p>How could I achieve this?</p>
  
  <hr>
  
  <p>I test <code>array_push</code> like <code>RaymondNijland</code> suggested:</p>
  
  <pre><code>array_push($array1[0],$array2);
  </code></pre>
  
  <p>But now the <code>$array1</code> looks like this:</p>
  
  <pre><code>array(1) {
    [0]=&gt;
    array(3) {
      ["1234"]=&gt;
       array(1) {
       ["fileName"]=&gt;
        string(10) "monkey.jpg"
         }
      ["3456"]=&gt;
         array(1) {
          ["fileName"]=&gt;
          string(9) "horse.jpg"   
        }
      }
      [0]=&gt;
      array(2) {
          ["number"]=&gt;
           string(2) "62"
           ["company"]=&gt;
           string(7) "animals"
      }
    }
  }
  </code></pre>
  
  <p>Still not the result I am looking for</p>