eregi_replace

string eregi_replace(string pattern, string replace, string subject) 
pattern Regex pattern to match
replace Replacement string
subject String to search using the pattern

Performs a non-case-sensitive 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 works like ereg_replace() except for ignoring the case when matching alphabetic characters.

See also:

ereg_replace() 
preg_replace() 

Example:

Keep quips up to date (non-case-sensitive version)
 $string = "Best way to dispose of the Borg: Give them WINDOWS ME."; echo eregi_replace("(Windows[ ]*)(3.1|95|98|me|2000|nt)", '\1XP', ...

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.