title: PHP: Set the values of one array to another array
body: <p>I want to create a new array, and set its keys equal to the values of another array.</p>
  
  <p>Start:</p>
  
  <pre><code>$names = array("don","james","jennifer","paul");
  $ages = array("don" =&gt; 25, "paul" =&gt; 32);
  </code></pre>
  
  <p>Finish:</p>
  
  <pre><code>$name_age_map = array(
   "don" =&gt; 25,
   "james" =&gt; null,
   "jennifer" =&gt; null,
   "paul" =&gt; 32,
  );
  </code></pre>
  
  <p>How should this be done in PHP? This is the best I've got so far:</p>
  
  <pre><code>$name_age_map = array();
  foreach ($names as $name) {
    $name_age_map[$name] = $name_map[$name]; 
  }
  </code></pre>
  
  <p>Ideally I wouldn't even create a new array, I'd just give element in $names a value of the age. </p>