PHP strrchr() Function

The strrchr() function finds the position of the last occurrence of a string within another string, and returns all characters from this position to the end of the string.

string strrchr ( string $haystack , mixed $needle )

This function returns the portion of haystack which starts at the last occurrence of needle and goes until the end of haystack.

Example -

ParameterDescription
haystackThe string to search in
needleIf needle contains more than one character, only the first is used. This behavior is different from that of strstr().If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.

Return Values

This function returns the portion of string, or FALSE if needle is not found.