in_array does a linear search. With this many elements in the list it won't be a fast search. It seems like this big list could be replaced with some regular expressions as well.