note 56860 added to function.str-ireplace
| From: | srange at hetnet dot nl | Date: | Sat, 17 Sep 2005 06:42:27 +0000 |
| Subject: | note 56860 added to function.str-ireplace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95320@lists.php.net to get a copy of this message | ||
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;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.str-ireplace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56860
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56860&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56860&report=yes
Search -- http://master.php.net/manage/user-notes.php