title: replace array keys with given respective keys
body: <p>I have an array like below</p>
  
  <pre><code>$old = array(
         'a' =&gt; 'blah',
         'b' =&gt; 'key',
         'c' =&gt; 'amazing',
         'd' =&gt; array(
                  0 =&gt; 'want to replace',
                  1 =&gt; 'yes I want to'
                )
         );
  </code></pre>
  
  <p>I have another array having keys to replace with key information.</p>
  
  <pre><code>$keyReplaceInfoz = array('a' =&gt; 'newA', 'b' =&gt; 'newB', 'c' =&gt; 'newC', 'd' =&gt; 'newD');
  </code></pre>
  
  <p>I need to replace all keys of array <code>$old</code> with respective values in array <code>$keyReplaceInfo</code>. </p>
  
  <p>Output should be like this </p>
  
  <pre><code>$old = array(
         'newA' =&gt; 'blah',
         'newB' =&gt; 'key',
         'newC' =&gt; 'amazing',
         'newD' =&gt; array(
                  0 =&gt; 'want to replace',
                  1 =&gt; 'yes I want to'
                )
         );
  </code></pre>
  
  <p>I had to do it manually as below. I am expecting better option. can anyone suggest better way to accomplish this?</p>
  
  <pre><code>$new = array();
  foreach ($old as $key =&gt; $value)
  {
       $new[$keyReplaceInfoz[$key]] = $value;
  }
  </code></pre>
  
  <p>I know this can be more simpler.</p>