title: PHP compare values in a single array and output the difference
body: <p>I have an array that looks like this:</p>
  
  <pre><code>$rowarray(
  [0] =&gt; [PID] =&gt; 97162 [TID] =&gt; 340 [StatsID] =&gt; 49678
  [1] =&gt; [PID] =&gt; 97165 [TID] =&gt; 340 [StatsID] =&gt; 49673
  [2] =&gt; [PID] =&gt; 97167 [TID] =&gt; 340 [StatsID] =&gt; 49675
  [3] =&gt; [PID] =&gt; 97162 [TID] =&gt; 340 [StatsID] =&gt; 49679
  )
  </code></pre>
  
  <p>Then my code looks like this:</p>
  
  <pre><code>$cntr=0;
  foreach($rowarray as $row)
  {
   echo "&lt;tr&gt;&lt;td&gt;$row[PID] $row[TID] $row[StatsID] &lt;/td&gt;&lt;/tr&gt;";
  $cntr++;
  }
  </code></pre>
  
  <p>Two things I want to do I want to be able not print the duplicates in the array but print the additional column that has a different value. So my desired output would look like this.</p>
  
  <p>97162 340 49678 49679</p>
  
  <p>97165 340 49673</p>
  
  <p>97167 340 49675</p>
  
  <p>I started out with the array_unique() but that only returned:</p>
  
  <p>97162 340 49678</p>