strrchr

string strrchr(string string, string character) 

Returns all characters after the last occurrence of character within string, including character.

Returns:

String; FALSE if needle is not found in haystack

Description:

strrchr() finds the position of the last occurrence of character within string and returns all characters from this position to the end of the string. If character cannot be found, FALSE is returned.

Version:

PHP 3+, PHP 4+

See also:

Other functions that find characters within strings:

substr() 
stristr() 
strpos() 
strrpos() 
strstr() 

Example:

Look for the last position of a string within another string
 <?php $string = "It's 4am, do you know where your brain is?"; $chr = 'o'; $result = strrchr ($string, $chr); if (FALSE ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.