note 22343 added to function.str-replace
| From: | anton at titov dot info | Date: | Fri, 14 Jun 2002 10:26:32 +0000 |
| Subject: | note 22343 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31852@lists.php.net to get a copy of this message | ||
For case insensitive replace use preg_replace:
$newstring=preg_replace("/old/i", "New", "Old string.");
so "my" implementation ot stri_replace:
function stri_replace($old, $new, $haystack){
return preg_replace('/'.quotemeta($old).'/i', $new, $haystack);
}
--
http://www.php.net/manual/en/function.str-replace.php
http://master.php.net/manage/user-notes.php?action=edit+22343
http://master.php.net/manage/user-notes.php?action=delete+22343
http://master.php.net/manage/user-notes.php?action=reject+22343