title: Get an array of duplicate array values
body: <p>I have an array where I'm testing for duplicate values. I want to get an array of only the duplicate values, to give an error message to the user, noting which are the offending values. I tried</p>
  
  <pre><code>$duplicates = array_diff( $array_with_dupes, array_unique($array_with_dupes) );
  </code></pre>
  
  <p>But that didn't return the only the duplicate values -- instead I got an empty array. </p>
  
  <p>What's a simple way to do this?</p>