note 60075 added to function.strrchr
| From: | freakinunrealathotmaildotcom at osu1 dot php dot net | Date: | Sun, 25 Dec 2005 06:54:06 +0000 |
| Subject: | note 60075 added to function.strrchr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100678@lists.php.net to get a copy of this message | ||
to marcokonopacki at hotmail dot com.
I had to make a slight change in your function for it to return the complete needle inclusive.
// Reverse search of strrchr.
function strrrchr($haystack,$needle)
{
// Returns everything before $needle (inclusive).
//return substr($haystack,0,strpos($haystack,$needle)+1);
// becomes
return substr($haystack,0,strpos($haystack,$needle)+strlen($needle));
}
Note: the +1 becomes +strlen($needle)
Otherwise it only returns the first character in needle backwards.
----
Manual Page -- http://www.php.net/manual/en/function.strrchr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60075
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60075&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60075&report=yes
Search -- http://master.php.net/manage/user-notes.php