$string = "01234567890*****12345678901234567890*"; echo strrpos($string,'*****');
why does this return 36, not 15? ( click here to check)
from php.net
strrpos . Find the position of the last occurrence of the substring. in line
What am I missing ???? Thanks!
SOLUTION: using the answers below, I have provided an alternative to PHP4
$haystack = "01234567890*****12345678901234567890*"; $needle = '*****'; $position = strlen($haystack) - strlen($needle) - strpos(strrev($haystack),strrev($needle)); echo $position;
source share