php string function strripos definition and syntax?
The PHP Strripos () function is where the last occurrence of a string is found in another string. This function is case-insensitive and its related functions are:
-
Stripos ()-finds the position of the first occurrence of a string in another string (case insensitive)
-
Strpos ()-finds the position of the first occurrence of a string in another string (case-sensitive)
-
Strrpos ()-Finds the last occurrence of a string in another string (case-sensitive)
Syntax for PHP strripos () function
Strripos (String,find,start)
The function has three parameters, where the first two parameters are necessary, the third parameter is optional
| Parameters |
Description |
| String |
Necessary. Specifies the string to be searched. |
| Find |
Necessary. Specifies the character to find. |
| Start |
Optional. Specify where to start the search. |
The return value of the PHP Strripos () function
The Strripos () function returns the position of the last occurrence of a string in another string, or FALSE if no string is found. the string position starts at 0, not starting from 1.
PHP Strripos () Function Example
Use the PHP strripos () function to find the location of the last occurrence of "PHP" in the string, with the following code:
<?phpecho Strripos ("You love php, I love php too!", "PHP"); >
The code runs the browser output result:
"Related articles recommended"
The definition and usage of PHP string function Stripos ()
PHP Strpos () function instance detailed
Detailed string function Strrpos ()