ereg_replace

string ereg_replace(string pattern, string replacement, string subject) 
pattern Regex pattern to match
replacement Replacement string
subject String to search using the pattern

Performs POSIX regular expression match and replaces the matches in the subject with the specified replacement.

Returns:

Modified string if the pattern matched; unmodified string if not

Description:

This function replaces any matches for the pattern with a replacement in a specified subject string. The entire string is searched for the pattern and all the matches are replaced. This allows a global search and replace to be done quickly and easily.

The replacement string can contain references of the form \n , where n is a number from 0 to 9. Before 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.