Javatpoint Logo
Javatpoint Logo

PHP strrchr() Function

The strrchr() function in inbuilt function of PHP. It is used to find the position of the last occurrence of a string.

This function returns all characters from this position to the end of the string or FALSE if the character is not found.

Note: The strrchr() function is binary-safe.


Parameter Description Required/Optional
String Specify the string to search. required
Char Specify the string to find by using ASCII value. required

Example 1


Your first string is:Hello PHP
Your second string is:PHP
By using 'strrchr()' function:P

Example 2


Your string is:We are Learning PHP
By using 'strrchr()' function:arning PH

Example 3


Your string is:Hello PHP
By using 'strrchr()' function:ello PHP

See Also:

strncmp() : String comparison of the first n characters (case-sensitive)

strpbrk() : Searches a string for any of a set of characters

strpos() :Returns the position of the first occurrence of a string inside another string (case-sensitive)

Next TopicPHP String

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA