title: Add duplicated values of a php array to another and keep the same keys
body: <p>I have a PHP Array, and I want to extract from it the duplicated values and keep the corresponding keys for each value, in a new Array.</p>
  
  <p>This is my starting Array</p>
  
  <pre><code>Array
  (
      [0] =&gt; ABC123-A
      [1] =&gt; BG231-B
      [2] =&gt; ABC123-A
      [3] =&gt; BG231-E
      [4] =&gt; BG231-F
      [5] =&gt; BG231-G
      [6] =&gt; BG231-H
      [7] =&gt; ABC123-A
      [8] =&gt; BG231-J
      [9] =&gt; BG231-K
      [10] =&gt; ABC123-A
  )
  </code></pre>
  
  <p>And this is what I want to have:</p>
  
  <pre><code>Array
  (
      [0] =&gt; ABC123-A
      [2] =&gt; ABC123-A
      [7] =&gt; ABC123-A
      [10] =&gt; ABC123-A
  )
  </code></pre>
  
  <p>How can I do that ?</p>
  
  <p>Thanks for help.</p>