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 FALSE if the string is not found. Note: The string position starts from 0, not from 1. |
PHP Version: | 4+ |
Update Log: |
From PHP 5.0 onwardsfind The parameter can be a string containing more than one character. In PHP 5.0, a new feature was added start Parameters. |