Find all array keys that has same value
Is there a simpler way to get all array keys that has same value, when the value is unknown. The problem with array_unique is that it returns the unique array and thus it doesn't find unique values. That is, for example, from this array: Array ( [a]=>1000 [b]=>1 [c]=>1000 ) I want to get this Array ( [a]=>1000 [c]=>1000 ) Another way around this is, if I could find the lonely values, and then their keys, and then use array_diff This is what I've got so far, looks awful: $a = array( 'a' => 1000, 'b' => 1, 'c' => 1000 ); $b = array_flip( array_count_values( $a ) ); krsort( $b ); $final = array