There are lots of different ways of doing this, but as you have seen array_unique() is not what you want.
One way would be to count how many occurrences of each value exist in the array, then either keep values that appear just once (your “unique” values) or multiple times. Two different methods of getting those values in PHP are below.
Of course if you only want the “unique” values, or only want the non-“unique” values, then you can skip building the unneeded array. The key part to both of the above code snippets is using array_count_values() to count how many times each value occurs in the array.
The idea is:
Associatively Diff the array and it’s Unique counterpart, which gives you the non-unique values, then Diff the original array with the non-uniques, and you get the uniques.