Searches for the position of "world" in a string and returns all characters from that position to the end of the string:
<?phpecho strrchr("Hello world!","world");?>The strrchr() function finds the last occurrence of a string within another string and returns all characters from that position to the end of the string.
Note: This function is binary safe.
strrchr( string,char )
parameter | describe |
---|---|
string | Required. Specifies the string to be searched for. |
char | Required. Specifies the characters to search for. If the argument is a number, the search is for characters matching the numeric ASCII value. |
Return value: | Returns all characters from the last occurrence of a string in another 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. |
Searches for the position of "" in a string and returns all characters from that position to the end of the string:
<?phpecho strrchr("Hello world! What a beautiful day!",What);?>Searches for the position of "o" in a string by its ASCII value and returns all characters from that position to the end of the string:
<?phpecho strrchr("Hello world!",111);?>