The strripos() function finds the position of the last occurrence of a string inside another string. The strripos() function is case-insensitive.
PHP strripos() Function has the following syntax.
strripos(string,find,start)
Parameter | Is Required | Description |
---|---|---|
string | Required. | String to search |
find | Required. | String to find |
start | Optional. | Where to begin the search |
PHP strripos() Function returns the position of the last occurrence of a string inside another string, or FALSE if the string is not found.
String positions start at 0, and not 1.
Find the position of the last occurrence of "php" inside the string:
<?php
echo strripos("php from java2s.com","PHP");
?>
The code above generates the following result.