Calling 1-2 times `in_array` should be more expensive than calling `array_unique` at the end.