note 56860 deleted from function.str-ireplace by mazzanet
| From: | mazzanet@php.net | Date: | Sat, 17 Sep 2005 11:15:39 +0000 |
| Subject: | note 56860 deleted from function.str-ireplace by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95327@lists.php.net to get a copy of this message | ||
Note Submitter: srange at hetnet dot nl
----
this is my version of str_ireplace for php4
i used the sample that where in here but when replacing
#14345 id did not work i change colors in my format so
this function works fine
<?PHP
function str_ireplace ($needle,$Replace,$Return)
{
$looptru = "1";
while ($looptru=="1") {
$pos1 = strpos(strtolower($Return),strtolower($needle));
if ($pos1===false) {$pos1=-1;$looptru = "0";}
if ($pos1>=0){
if (isset($Replace)){
$Return = substr_replace ($Return,$Replace, $pos1,strlen($needle));
}
else{
$Return = substr_replace ($Return,"", $pos1,strlen($needle));
}
}
}
return $Return;
}
?>