Home > Article > Backend Development > How to use php strrchr function
PHP strrchr function is used to find the last occurrence of a specified character in a string. Its syntax is strrchr (string, char). The parameter string is required and specifies the string to be searched; char is required and specifies the string to be searched. character.
php How to use strrchr function?
php strrchr() function syntax
Function: Returns the position of the last occurrence of a string in another string, and returns all characters from that position to the end of the string Characters
Syntax:
strrchr(string,char)
Parameters:
string Required. Specifies the string to search for.
char Required. Specifies the characters to search for. If the argument is a number, searches for characters matching the ASCII value of this number.
Description:
Find the last occurrence of a string in another string and return all characters from that position to the end of the string.
This function is binary safe.
php strrchr() function usage example 1:
<?php echo strrchr("I'm study in php.cn!","study"); ?>
Output:
study in php.cn!
php strrchr() function usage example 2:
<?php echo strrchr("i like php","like"); ?>
Output:
like php
This article is an introduction to the PHP strrchr function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php strrchr function. For more information, please follow other related articles on the PHP Chinese website!