title: PHP: How to identify AND CHANGE duplicate values in an array?
body: <p>OK, there are a lot of examples of duplicate detection and removal in php arrays, using array_unique() etc but what if you want to find dups, modify them, check again in a loop until all dups are now unique?</p>
  
  <p>I think it's something like using array_filter()... so as a more specific example, here's what would come out of a sql statement something like this:</p>
  
  <pre><code>SELECT id, list.comboname 
  FROM list
     INNER JOIN (
        SELECT comboname 
        FROM list
         GROUP BY comboname 
         HAVING count(id) &gt; 1
     ) dup ON list.comboname = dup.comboname
  </code></pre>
  
  <p>To an array of the duplicates in the table:</p>
  
  <pre><code>Array ( 
      [0] =&gt; 49 
      [1] =&gt; big.dup  
      [2] =&gt; 233  
      [3] =&gt; another.duplicate  
      [4] =&gt; 653  
      [5] =&gt; big.dup  
      [6] =&gt; 387  
      [7] =&gt; big.dup  
      [8] =&gt; 729  
      [9] =&gt; another.duplicate  
      [10] =&gt; 1022  
      [11] =&gt; big.dup   
  )
  </code></pre>
  
  <p>Now what I want is some PHP to delete characters until the period so they are unique [or add numbers if needed to the end]</p>
  
  <p>So result would be:</p>
  
  <pre><code>Array (  
      [0] =&gt; 49  
      [1] =&gt; big.dup  
      [2] =&gt; 233  
      [3] =&gt; another.duplicate  
      [4] =&gt; 653  
      [5] =&gt; big.du  
      [6] =&gt; 387  
      [7] =&gt; big.d  
      [8] =&gt; 729  
      [9] =&gt; another.duplicat  
      [10] =&gt; 1022  
      [11] =&gt; big.dup1  
  )
  </code></pre>
  
  <p>While retaining the original value (i.e. big.dup and another.duplicate)... I've looked through just about every PHP array function trying to imagine a strategy ... ideas?</p>