title: Check and return duplicates array php
body: <p>I would like to check if my array has any duplicates and return the duplicated values in an array.
  I want this to be as efficient as possible.</p>
  <p>Example:</p>
  <pre><code>$array = array( 1, 2, 2, 4, 5 );
  function return_dup($array); // should return 2
  
  $array2 = array( 1, 2, 1, 2, 5 );
  function return_dup($array2); // should return an array with 1,2
  </code></pre>
  <p>Also the initial array is always 5 positions long</p>