title: PHP: How to compare keys in one array with values in another, and return matches?
body: <p>I have the following two arrays:</p>
  
  <pre><code>$array_one = array('colorZero'=&gt;'black', 'colorOne'=&gt;'red', 'colorTwo'=&gt;'green', 'colorThree'=&gt;'blue', 'colorFour'=&gt;'purple', 'colorFive'=&gt;'golden');
  
  $array_two = array('colorOne', 'colorTwo', 'colorThree');
  </code></pre>
  
  <p><strong>I want an array from <code>$array_one</code> which only contains the key-value pairs whose keys are members of $array_two</strong> (either by making a new array or removing the rest of the elements from <code>$array_one</code>)</p>
  
  <p>How can I do that?</p>
  
  <p>I looked into <code>array_diff</code> and <code>array_intersect</code>, but they compare values with values, and not the values of one array with the keys of the other.</p>