Searching for a Pattern Using preg_match()
PHP String FunctionsThe preg_match() function searches a string for a specific pattern, returning TRUE if it exists and FALSE otherwise.
preg_match(string pattern, string string [, array matches] [, int flags [, int offset]]])
The optional input parameter matches can contain various sections of the sub-patterns contained in the search pattern, if applicable.
You can use the optional flags parameter to modify the behavior of the returned matches parameter, changing how the array is populated by instead returning every matched string and its corresponding offset as determined by the location of the match.
The optional offset parameter will adjust the search starting point within the string to a specified position.