in_array() takes (needle, haystack), but I had accidentally put (haystack, needle).