I know there is array_unique function, but I want to remove duplicates. Is there a built-in function or do I have to roll my own.
array_unique
Example input:
The answer on top looks great, but on a side note: if you ever want to eliminate duplicates but leave the first one, using array_flip twice would be a pretty simple way to do so. array_flip(array_flip(x))