hi,
to find out last char we use lastIndexOf method in java, what is the similiar method in php
java lastIndexOf is specified,what is the similar method ini
Moderator: General Moderators
Re: java lastIndexOf is specified,what is the similar method ini
There is no native one (as far as I know).
A copy-paste-code from http://bg2.php.net/strrpos :
A copy-paste-code from http://bg2.php.net/strrpos :
Code: Select all
function rstrpos ($haystack, $needle, $offset)
{
$size = strlen ($haystack);
$pos = strpos (strrev($haystack), strrev($needle), $size - $offset);
if ($pos === false)
return false;
return $size - $pos - strlen($needle);
}There are 10 types of people in this world, those who understand binary and those who don't