HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
PHP String Reference : Search a string for "world", and return all characters from this position to the end of the string
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.
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 |
Return Value: | Returns all characters from the last occurrence of a string within another string, to the end of the main string, or FALSE if the character is not found |
---|---|
PHP Version: | 4+ |
Changelog: | This function was made binary-safe in PHP 4.3 |
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");
?>
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);
?>
❮ PHP String Reference