I am working with an array constructed from input from a form. I need to find if two values are in the array in sequence. If I use in_array it comes back true searching for one value or the other, but I need to find if they are in sequence as there is a chance two values are in the array. Example:
[0] => location [1] => Riverside [2] => location [3] => Other [4] => subcat1 [5] => Motorcycle [6] => subcat2 [7] => Other.
If I use array_search or in_array, looking for 'Other' it returns true and stops on the first value found, but I need to know if the value subcat2 is immediately followed by 'Other' in the array. Using the values repopulates the form and since 'Other' is in the array twice (or more), it marks all the 'Other' options in the form. I want to capture the value pairs. Any ideas?