opposite of array_unique()?
| From: | Adam Williams | Date: | Wed, 04 Aug 2004 19:20:50 +0000 |
| Subject: | opposite of array_unique()? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192739@lists.php.net to get a copy of this message | ||
array_unique() removes duplicate values from an array.
Is there an opposite function or way of keeping all values in a single
dimentional array that are duplicates and removing all that are
duplicates?
for example if I have an array:
array( [0] => 'dog', [1] => 'cat', [2] => 'rabbit', [3] =>
'cat')
how do I make it just have array ( [0] => 'cat' )? i want to drop the
non-duplicates and trim the array to only have one of the duplicates?