what is the syntax of the STRRCHR() function in php?
strrchr(string,char)
Parameter | Description |
---|---|
string | Required. Specifies the string to search |
char | Required. Specifies the string to find. If this is a number, it will search for the character matching the ASCII value of that number |
examples of the STRRCHR() function
Example 1. In this example, we search a string for “world”, and return all characters from this position to the end of the string.
<?php
echo strrchr("Hello world!","world");
?>
Example 2. In this example, we search a string for “What”, and return all characters from this position to the end of the string.
<?php
echo strrchr("Hello world! What a beautiful day!", "What");
?>
Example 2. In this example, search a string for the ASCII value of “e” (101) and return all characters from this position to the end of the string.
<?php
echo strrchr("Hello world!",101);
?>