TypeError thrown

in_array(): Argument #2 ($haystack) must be of type array, int given