split

array split(string pattern, string subject, [int limit]) 
pattern Regex pattern to split by
subject Input string to split
limit Limits the number of results

Splits the subject string along the boundaries defined by the specified POSIX regular expression pattern.

Returns:

Array containing the results of splitting; FALSE if an error occurs

Description:

This function splits the given subject string into substrings on the boundaries matching the specified pattern . The optional parameter limit specifies how many pieces to return; if -1 or omitted, all pieces are returned. Otherwise, exactly limit pieces are returned, with the last piece containing the remainder of the subject string that was not split.

If the string needs to be split ...

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.