$string = "01234567890*****12345678901234567890*";
echo strrpos($string,'*****');
why does this return 36 and not 15? (click here to test)
from php.net
strrpos — Find the position of the last occurrence of a substring
in a string
What am I missing out on???
Thank you!
SOLUTION:
using the answers bellow, I provided a PHP4 alternative
$haystack = "01234567890*****12345678901234567890*";
$needle = '*****';
$position = strlen($haystack) - strlen($needle) - strpos(strrev($haystack),strrev($needle));
echo $position; // 11
Probably you’re using PHP 4:
from php.net
needle:
If needle is not a string, it is converted to an integer and applied as the ordinal value of a character. The needle can only be a single character in PHP 4.