PHP strrchr() Function


The strrchr() function is used to search for the last occurrence of a given string within another string .

Syntax
strrchr(string,char)
Parameters
  • String - (Required) Specify the string to search.
  • char - (Required) Specify the string to using the Ascii Value.
Example
<?php
    echo strichr("Hii Hello!","Hello");
?>

Output

Hello!
Example
<?php
    echo strrchr("Hello students",117);
?>

Output

udents
Search a string for the ASCII value of "u" (117) and return all characters from this position to the end of the string

Prev Next