Move is_array check to the first check

To avoid strtolower and trim "expect parameter 1 to be string" exception