title: Convert PHP array into Key => Value Array
body: <p>Total PHP Noob and I couldn't find an answer to this specific problem.  Hope someone can help!</p>
  
  <p>$myvar is an array that looks like this:</p>
  
  <pre><code>Array (  
   [aid] =&gt; Array (  
    [0] =&gt; 2  
    [1] =&gt; 1  
   )  
   [oid] =&gt; Array(  
    [0] =&gt; 2  
    [1] =&gt; 1  
   )  
  )
  </code></pre>
  
  <p>And I need to set a new variable (called $attributes) to something that looks like this:</p>
  
  <pre><code>$attributes = array(
   $myvar['aid'][0] =&gt; $myvar['oid'][0], 
   $myvar['aid'][1] =&gt; $myvar['oid'][1], 
   etc...
  );
  </code></pre>
  
  <p>And, of course, $myvar may contain many more items...</p>
  
  <p>How do I iterate through $myvar and build the $attributes variable?</p>