This should work for you:
Just iterate over all the unique values you get with the array_unique()foreach loop. Here is something like this:
Array
(
[0] => Coats
[1] => Brushs
[2] => others
[3] => None
)
And get all the keys that store this unique value with array_keys(). The tool in this example:
value | key(s)
--------------------------------------
Coats | Array (12, 23)
Brushs | Array (45)
others | Array (5)
None | Array (7, 8, 9)
Then you can implode()put your key array into a string and use it as a key.
code:
<?php
$array = array('12' => 'Coats', '23' => 'Coats', '45' => 'Brushs', '5' => 'others', '7' => 'None', '8' => 'None', '9' => 'None', );
$result = [];
foreach(array_unique($array) as $uniqueValue)
$result[implode(",", array_keys($array, $uniqueValue))] = $uniqueValue;
print_r($result);
?>
exit:
Array
(
[12,23] => Coats
[45] => Brushs
[5] => others
[7,8,9] => None
)