title: How to merge two arrays in php?
body: <p>I have the following arrays which I'd like to combine / merge to create a single array that I can loop through to add images and their respective titles to a database.</p>
  
  <p><strong>Array 1:</strong></p>
  
  <pre><code>[0] =&gt; array(1) {
    ["filename"] =&gt; string(22) "1463668615_1_image.jpg"
  }
  [1] =&gt; array(1) {
    ["filename"] =&gt; string(22) "1463668641_1_image.jpg"
  }
  </code></pre>
  
  <p><strong>Array 2:</strong></p>
  
  <pre><code>[0] =&gt; array(1) {
    ["title"] =&gt; string(15) "My image title"
  }
  [1] =&gt; array(1) {
    ["title"] =&gt; string(5) "Title"
  }
  </code></pre>
  
  <p>Here's the format of the array I'd like to create.</p>
  
  <p><strong>Merged Arrays:</strong></p>
  
  <pre><code>[0] =&gt; array(2) {
    ["filename"] =&gt; string(22) "1463668615_1_image.jpg",
    ["title"] =&gt; string(3) "My image title"
  }
  [1] =&gt; array(2) {
    ["filename"] =&gt; string(22) "1463668641_1_image.jpg",
    ["title"] =&gt; string(0) "Title"
  }
  </code></pre>