Hi,
strripos() vs strrpos()
strripos -- Find position of last occurrence of a case-insensitive string in a string
strrpos -- Find position of last occurrence of a char in a string
PHP Code:
<?php
/*-----------STRRIPOS------------------------*/
$haystack = 'ababcd';
$needle = 'aB';
$pos = strripos($haystack, $needle);
if ($pos === false) {
echo "Sorry, we did not find ($needle) in ($haystack)";
} else {
echo "Congratulations!\n";
echo "We found the last ($needle) in ($haystack) at position ($pos)";
}
/*-------------------------------------------*/
/*-----------STRRPOS------------------------*/
// in PHP 4.0b3 and newer:
$pos = strrpos($mystring, "b");
if ($pos === false) { // note: three equal signs
// not found...
}
// in versions older than 4.0b3:
$pos = strrpos($mystring, "b");
if (is_bool($pos) && !$pos) {
// not found...
}
/*-------------------------------------------*/
?>
Thanks