title: PHP splitting arrays into groups based on equal values
body: <p>I have an Array containing arrays with 2 values, the first one is the Number of the Author the second is his Affiliation.</p>
  
  <pre><code>Array ( 
      [0] =&gt; Array ( 
              [0] =&gt; 2 
              [1] =&gt; Department of General Chemistry
          ) 
      [1] =&gt; Array ( 
              [0] =&gt; 3 
              [1] =&gt; Institute of Silicate Materials
          ) 
      [2] =&gt; Array ( 
              [0] =&gt; 4 
              [1] =&gt; Department of General Chemistry
          ) 
      [3] =&gt; Array ( 
              [0] =&gt; 5 
              [1] =&gt; Department of General Chemistry
          ) 
      [4] =&gt; Array ( 
              [0] =&gt; 6 
              [1] =&gt; Institute of Silicate Materials
          ) 
  )
  </code></pre>
  
  <p>How can I group the Authors if the Affiliation is the same? I need the output to be something like:</p>
  
  <pre><code>3,6 Institute of Silicate Materials
  2,4,5 Department of General Chemistry
  </code></pre>