title: Combining arrays based on keys from another array
body: <p>I want to combine two arrays like this:</p>
  
  <p>1st array:
  <code></p>
  
  <pre><code>   array( "ATTENDED"        =&gt; 1,
            "TENTATIVE"       =&gt; 2,  //
            "REJECTED"        =&gt; 3,
            "OUTSTANDING"     =&gt; 4,  
            "ACCEPTED"        =&gt; 6
          );
  </code></pre>
  
  <p></code>
  2nd Array:
  <code></p>
  
  <pre><code>  array ( 1 =&gt; 29, 
            4 =&gt; 30, 
            6 =&gt; 47 
          );
  </code></pre>
  
  <p></code></p>
  
  <p>I want to get the results like this:
  <code></p>
  
  <pre><code>  array ( 'ATTENDED' =&gt; 29, 
            'OUTSTANDING' =&gt; 30, 
            'ACCEPTED' =&gt; 47
          );
  </code></pre>
  
  <p></code></p>
  
  <p>2nd array is flexible. I can flip keys and values. </p>
  
  <p>or better yet:
  <code></p>
  
  <pre><code>   array( "ATTENDED"    =&gt; 29,
        "TENTATIVE"       =&gt; 0,  //
        "REJECTED"        =&gt; 0,
        "OUTSTANDING"     =&gt; 30,  
        "ACCEPTED"        =&gt; 47
       );
  </code></pre>
  
  <p></code>
  I know there must be a simple solution. 
  Any ideas?</p>