Home >Backend Development >PHP Tutorial >Detailed explanation of php string function strripos() example
The definition and syntax of php string function strripos?
php strripos() function is to find the last occurrence of a string in another string. This function is not case-sensitive. Its related functions are:
stripos() - Find the first occurrence of a string in another string (not case sensitive)
strpos() - Find the first occurrence of a string in another string (case sensitive)
strrpos() - Find the last occurrence of a string in another string (case sensitive)
php strripos() function syntax
strripos(string,find,start)
This function has three parameters, the first two parameters are required, and the third parameter is optional
Parameter | Description |
---|---|
##string | Required. Specifies the string to be searched for.|
find | Required. Specifies the characters to search for.|
start | Optional. Specifies the location from which to start the search.
php strripos() function return value
strripos() functionreturns a string in another string The position of the last occurrence in , or FALSE if the string is not found. The string position starts from 0, not from 1.
php strripos() function example
Use the php strripos() function to find the last occurrence of "php" in the string. The code is as follows:<?php echo strripos("You love php, I love php too!","PHP"); ?>The code runs the browser output result:
[Related article recommendations]
##php The definition and usage of string function stripos()php strpos() function example detailed explanationDetailed explanation of string function strrpos()The above is the detailed content of Detailed explanation of php string function strripos() example. For more information, please follow other related articles on the PHP Chinese website!