note 35055 rejected from function.str-replace by didou
| From: | didou@php.net | Date: | Mon, 18 Aug 2003 07:44:44 +0000 |
| Subject: | note 35055 rejected from function.str-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54561@lists.php.net to get a copy of this message | ||
Note Submitter: websys007@yahoo.ca
----
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;
}