PHP - Function eregi_replace()



Syntax

 string eregi_replace (string pattern, string replacement, string originalstring); 

Definition and Usage

The eregi_replace() function operates exactly like ereg_replace(), except that the search for pattern in string is not case sensitive.

Return Value

  • After the replacement has occurred, the modified string will be returned.

  • If no matches are found, the string will remain unchanged.

Example

Following is the piece of code, copy and paste this code into a file and verify the result.

 <?php $copy_date = "Copyright 2000"; $copy_date = eregi_replace("([a-z]+)", "&Copy;", $copy_date); print $copy_date; ?> 

This will produce the following result −

Eregi Replace
php_regular_expression.htm
Advertisements