
PHP Function: Built-in Functions part 10
Regular Expression Functions
ereg_replace() and eregi_replace()
The ereg_replace() and eregi_replace() functions replace instances of a pattern within a string and return the new string. The ereg_replace() function performs a clase-sensitive match, and eregi_replace() performs a case-insensitive match. Here is the syntax for both functions:
ereg_replace(pattern, replacement, string);
eregi_replace(pattern, replacement, string);
For example, you would use the following code to replace “ASP” with “PHP” in the string “I really love programming in ASP”:
