PHP strrpos() Function
Example
Find the last occurrence position of "php" in the string:
<?php echo strrpos("You love php, I love php too!","php"); ?>
Definition and Usage
The strrpos() function finds the last occurrence position of the string in another string.
Note:The strrpos() function is case sensitive.
Related Functions:
- stripos() - Find the first occurrence position of the string in another string (case insensitive)
- strpos() - Find the first occurrence position of the string in another string (case sensitive)
- strripos() - Find the last occurrence position of the string in another string (case insensitive)
Syntax
strrpos(string,find,start)
Parameters | Description |
---|---|
string | Required. Specifies the string to be searched. |
find | Required. Specifies the character to be searched for. |
start | Optional. Specifies where to start the search. |
Technical Details
Return Value: |
Returns the last occurrence position of the string in another string, or returns FALSE if the string is not found. Note: The string position starts from 0, not from 1. |
PHP Version: | 4+ |
Update Log: |
Since PHP 5.0:find The parameter can be a string containing more than one character. Newly added in PHP 5.0: start Parameters. |