Home >>PHP String Functions >PHP strrchr Function
PHP strrchr() function is used to find the position of the last occurrence of a given string within another string. It returns all the characters starting from the last occurrence position to the end of the string. It is binary-safe.
Syntax:strrchr($string, $char);
Parameter | Description |
---|---|
string | This is a required parameter. This parameter defines the string to search. |
char | This is a required parameter. This parameter defines the string to find. |
<html> <body> <?php echo strrchr("PHPTPOINT","Point"); ?> </body> </html>
<html> <body> <?php $str = "Hello Everyone!! I am Jerry.. Nice to meet you all."; echo strrchr($str, "I am"); ?> </body> </html>