note 59476 deleted from function.str-ireplace by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 11 Dec 2005 07:42:33 +0000 |
| Subject: | note 59476 deleted from function.str-ireplace by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99949@lists.php.net to get a copy of this message | ||
Note Submitter: marin
----
I wanted to use this function using an old version of php :-(
Of course, i was not working, so i coded a little function to replace the original :
function escape_regex($t) {
$t = str_replace(".", "\\.", $t);
$t = str_replace("+", "\\.", $t);
$t = str_replace("*", "\\*", $t);
$t = str_replace("[", "\\[", $t);
$t = str_replace("]", "\\]", $t);
$t = str_replace("?", "\\?", $t);
$t = str_replace("$", "\\$", $t);
$t = str_replace("^", "\\^", $t);
$t = str_replace("(", "\\(", $t);
$t = str_replace(")", "\\)", $t);
$t = str_replace("\\", "\\\\", $t);
$t = str_replace("|", "\\|", $t);
return $t;
}
function str_ireplace($search, $replace, $subject) {
eregi_replace(escape_regex($search), escape_regex($replace), $subject);
}