remove unique values from array?
Posted: Thu Jan 15, 2004 11:57 pm
I know of the function array_unique that removes duplicate values. However I need to have an array stripped of its values that only appear once in the array.
example:
array1( [0] => apple, [1] => orange, [2] => orange, [3] => cheese )
I would need a resulting array like:
array2( [1] => orange, [2] => orange )
The keys do NOT matter at all - they could remain as they were in the original array, or they could be recreated. Whatever works.
I'll probably run the stripped-down array through array_unique so I end up with an array listing the duplicate items in the original array.
Thanks-
Dave
example:
array1( [0] => apple, [1] => orange, [2] => orange, [3] => cheese )
I would need a resulting array like:
array2( [1] => orange, [2] => orange )
The keys do NOT matter at all - they could remain as they were in the original array, or they could be recreated. Whatever works.
I'll probably run the stripped-down array through array_unique so I end up with an array listing the duplicate items in the original array.
Thanks-
Dave