I\'m trying to use array_flip
to print duplicate values in a comma separated format
$a=array(\"a\"=>\"red\",\"b\"=>\"green\",\"c\"=>\"b
You need to make your function along with array_flip
like as
$array = array("a"=>"red","b"=>"green","c"=>"blue","d"=>"blue");
$res = array_flip($array);
foreach ($res as $k => $v)
$res[$k] = implode(", ", array_keys($array, $k));
print_r($res);
Output :
Array
(
[red] => a
[green] => b
[blue] => c, d
)
Demo