title: How to merge array and preserve keys?
body: <p>I have two arrays:</p>
  
  <pre><code>$array1 = array('a' =&gt; 1, 'b' =&gt; 2, 'c' =&gt; 3);
  $array2 = array('d' =&gt; 4, 'e' =&gt; 5, 'f' =&gt; 6, 'a' =&gt; 'new value', '123' =&gt; 456);
  </code></pre>
  
  <p>I want to merge them and keep the keys and the order and not re-index!!</p>
  
  <p>How to get like this?</p>
  
  <pre><code>Array
  (
      [a] =&gt; new value
      [b] =&gt; 2
      [c] =&gt; 3
      [d] =&gt; 4
      [e] =&gt; 5
      [f] =&gt; 6
      [123] =&gt; 456
  )
  </code></pre>
  
  <p>I try to array_merge() but it will not be preserved the keys:</p>
  
  <pre><code>print_r(array_merge($array1, $array2));
  
  Array
  (
      [a] =&gt; 'new value'
      [b] =&gt; 2
      [c] =&gt; 3
      [d] =&gt; 4
      [e] =&gt; 5
      [f] =&gt; 6
      [0] =&gt; 456
  )
  </code></pre>
  
  <p>I try to the union operator but it will not overwriting that element:</p>
  
  <pre><code>print_r($array1 + $array2);
  
  Array
  (
      [a] =&gt; 1   &lt;-- not overwriting
      [b] =&gt; 2
      [c] =&gt; 3
      [d] =&gt; 4
      [e] =&gt; 5
      [f] =&gt; 6
      [123] =&gt; 456
  )
  </code></pre>
  
  <p>I try to swapped place but the order is wrong, not my need:</p>
  
  <pre><code>print_r($array2 + $array1);
  
  Array
  (
      [d] =&gt; 4
      [e] =&gt; 5
      [f] =&gt; 6
      [a] =&gt; new value 
      [123] =&gt; 456
      [b] =&gt; 2
      [c] =&gt; 3
  )
  </code></pre>
  
  <p><em><strong>I dont want to use a loop, is there a way for high performance?</em></strong></p>