title: PHP: Adding arrays together
body: <p>Could someone help me explain this? I have two snippets of code, one works as I expect, but the other does not.</p>
  
  <p><strong>This works</strong></p>
  
  <pre><code>$a = array('a' =&gt; 1, 'b' =&gt; 2);
  $b = array('c' =&gt; 3);
  $c = $a + $b;
  print_r($c);
  
  // Output
  Array
  (
      [a] =&gt; 1
      [b] =&gt; 2
      [c] =&gt; 3
  )
  </code></pre>
  
  <p><strong>This does not</strong></p>
  
  <pre><code>$a = array('a', 'b');
  $b = array('c');
  $c = $a + $b;
  print_r($c);
  
  // Output
  Array
  (
      [0] =&gt; a
      [1] =&gt; b
  )
  </code></pre>
  
  <p>What is going on here?? Why doesn't the second version also add the two arrays together? What have I misunderstood? What should I be doing instead? Or is it a bug in PHP?</p>