note 35055 added to function.str-replace
| From: | websys007 at yahoo dot ca | Date: | Mon, 18 Aug 2003 06:32:04 +0000 |
| Subject: | note 35055 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54556@lists.php.net to get a copy of this message | ||
This stri_replace() function is very short
I ran in to a bug to handle recursive replacements of short forms to long forms. I discovered a
quick and easy case insensitive string replace Would this use less cpu cycles then the other
stri_replace functions above?
function stri_replace($search,$replace,$text) {
$pos=strpos(strtolower($text),strtolower($search));
if ($pos!==false){
$text=substr_replace ( $text, $replace, $pos,strlen($search));
}
return $text;
}
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35055
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35055&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35055&report=yes