Find the last occurrence of "php" in a string:
<?phpecho strripos("I love php, I love php too!","PHP");?>The strripos() function finds the last occurrence of a string within another string (case-insensitive).
Note: The strripos() function is not case sensitive.
Related functions:
stripos() - Finds the first occurrence of a string within another string (case insensitive)
strpos() - finds the first occurrence of a string within another string (case sensitive)
strrpos() - Finds the last occurrence of a string within another string (case sensitive)
strripos( string,find,start )
parameter | describe |
---|---|
string | Required. Specifies the string to be searched for. |
find | Required. Specifies the characters to search for. |
start | Optional. Specifies the location to start the search. |
Return value: | Returns the position of the last occurrence of a string within another string, or FALSE if the string is not found. Note: The string position starts from 0, not from 1. |
---|---|
PHP version: | 5+ |
Update log: | Since PHP 5.0, the find parameter can be a string of more than one character. In PHP 5.0, the start parameter is added. |