note 78011 deleted from function.str-replace by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 16:15:52 +0000 |
| Subject: | note 78011 deleted from function.str-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142170@lists.php.net to get a copy of this message | ||
Note Submitter: marc at palaueb dot com
----
I'm searching for a function who replace the last occurrence of a string but I have not found
anything.
Check this out:
function str_rreplace($search,$replace,$subject){
$strrpos=strrpos($subject,$search);
return substr_replace($subject,$replace,$strrpos,strlen($search));
}
the only one problem is that do not have a limit to replace, just replace the last occurrence.