preg_match_all

int preg_match_all(string pattern, string subject, array matches, [int order]) 
pattern Regex pattern to match
subject String to search using the pattern
matches Array in which to store the search results
order Flag specifying the ordering of results

Finds all matches for the supplied pattern and stores them in the supplied array.

Returns:

Number of full pattern matches found

Description:

This function tries to find all the matches for the regular expression pattern in the supplied subject string. Upon a successful search, the previous contents of matches are overwritten with the search results. The matches parameter should be a valid variable, such as $matches, since the function forces it to be passed by reference.

The ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.