Home >Backend Development >PHP Tutorial >PHP function strrchr() to find the last occurrence of a string in another string
Example
Search for the position of "world" in string and return all characters from that position to the end of the string:
<?php echo strrchr("Hello world!","world"); ?>
Definition and Usage
strrchr() function finds the last occurrence of a string in another string and returns all characters from that position to the end of the string.
Note: This function is binary safe.
Syntax
strrchr(string,char)
Parameters | Description |
string | Required. Specifies the string to be searched for. |
char | Required. Specifies the characters to search for. If the argument is a number, then searches for characters matching the numeric ASCII value. |
Technical details
Return value: | Returns a string from a certain string in another All characters from the last occurrence of the string to the end of the main string. If the character is not found, returns FALSE. |
PHP Version: | 4+ |
##Update Log : | In PHP 4.3, this function became binary safe.
The above is the detailed content of PHP function strrchr() to find the last occurrence of a string in another string. For more information, please follow other related articles on the PHP Chinese website!