I have an Array containing arrays with 2 values, the first one is the Number of the Author the second is his Affiliation.

```
Array ( 
    [0] => Array ( 
            [0] => 2 
            [1] => Department of General Chemistry
        ) 
    [1] => Array ( 
            [0] => 3 
            [1] => Institute of Silicate Materials
        ) 
    [2] => Array ( 
            [0] => 4 
            [1] => Department of General Chemistry
        ) 
    [3] => Array ( 
            [0] => 5 
            [1] => Department of General Chemistry
        ) 
    [4] => Array ( 
            [0] => 6 
            [1] => Institute of Silicate Materials
        ) 
)

```

How can I group the Authors if the Affiliation is the same? I need the output to be something like:

```
3,6 Institute of Silicate Materials
2,4,5 Department of General Chemistry

```