Monday, 29 September 2014

strrchr in PHP

PHP strrchr() function is utilized to find the position of the final occurrence of a string inside another string(main string).
If char cannot be found, this function returns FALSE.

Syntax:

strrchr(string,char)
string : Required. Specifies the string to search

char : Required. Specifies the searched string.

Note : This function is binary-safe.

Example:

<?php
echo strrchr("Good Morning world!","Morning");
echo "<br /><strong> Example using ASCII code for search : </strong><br />";
echo strrchr("Good Morning",111);
?>
Output will be:
Morning world!
Example using ASCII code for search :
orning

0 comments:

Post a Comment