Here is a simple function to find the position of the next
occurrence of needle in haystack, but searching backwards
(lastIndexOf type function):
//search backwards for needle in haystack, and return its
position
function rstrpos ($haystack, $needle, $offset){
$size = strlen ($haystack);
$pos = strpos (strrev($haystack), $needle, $size -
$offset);
if ($pos === false)
return false;
return $size - $pos;
}
Note: supports full strings as needle
----
Server IP: 194.8.30.16
Probable Submitter: 82.154.203.167
----
Manual Page -- htt
p://www.php.net/manual/en/function.strrpos.php
Edit -- https://master
.php.net/note/edit/78499
Del: integrated -- h
ttps://master.php.net/note/delete/78499/integrated
Del: useless -- http
s://master.php.net/note/delete/78499/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78499/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78499/spam
Del: non-english --
https://master.php.net/note/delete/78499/non-english
Del: in docs -- http
s://master.php.net/note/delete/78499/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78499
Reject -- https://mast
er.php.net/note/reject/78499
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|