note 21825 added to function.strrpos

From: Date: Tue, 28 May 2002 16:46:56 +0000
Subject: note 21825 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-31103@lists.php.net to get a copy of this message
Cause: Find position of last occurrence of a string in a string... and I needed it, I hacked a little code to do this: Maybe it is helpful for you. function _strrpos_needle($sourcestring,$needle){ /* just for easier understanding */ $tempString=$sourcestring; do { $tempPos=strpos($tempString,$needle); $tempString=substr($tempString,$tempPos+strlen($needle)); $realPos=$realPos+$tempPos; } while (!is_bool($tempPos)); return $realPos; } -- http://www.php.net/manual/en/function.strrpos.php http://master.php.net/manage/user-notes.php?action=edit+21825 http://master.php.net/manage/user-notes.php?action=delete+21825 http://master.php.net/manage/user-notes.php?action=reject+21825

« previous php.notes (#31103) next »