Home > Article > Backend Development > Getting Started with PHP: strrchr Example Tutorial_PHP Tutorial
Getting started with PHP: strrchr example tutorial
Definition and usage
The strrchr() function identifies the position at which a series occurs in another string, and returns all characters starting from this position to the end of the string.
If the character cannot be found, this function returns FALSE.
Grammar
strrchr(string,char)
Parameter Description
string Required. Specify search string
char Required. The specified string. If this is a number, it will seek to match the ASCII value of this number of characters
Tips and Instructions Tip: This feature is binary safe.
Example 1 echo strrchr("Hello world!","world");
?>
Output results.
world!
Let’s look at another strrchr example.
Example 2
In this example, we will search for a string with an ASCII value of "0":
echo strrchr("Hello world!",111);
?>
Output results.orld!
www.111cn.cn/phper/php.html