I am trying to find all duplicates in my array, and create a new array which has keys as the duplicate values key and value as the key of its duplicate
example
[1] => 10
[2] => 11
[3] => 12
[4] => 12
[5] => 12
[6] => 13
[7] => 13
After I apply the duplicate check I just need
[4] => [3] // value of key 4 is dupe of key 3
[5] => [3] // value of key 5 is dupe of key 3
[7] => [6] // value of key 7 is dupe of key 6
this gets me all duplicate keys, but I need duplicate keys with values as the keys which are duplicate
$arr_duplicates = array_keys(array_unique( array_diff_assoc( $array, array_unique( $array ) ) ));
Thanks