strstr

string strstr(string string, mixed substring) 

Returns all of string after the first occurrence of substring.

Returns:

String; FALSE if the substring doesn’t exist in the string

Description:

strstr() returns all of string after the first occurrence of substring . If substring doesn’t exist in string , the function returns FALSE.

Version:

PHP 3+, PHP 4+

See also:

Other functions that find characters within strings:

strchr() 
stristr() 
strpos() 
strrpos() 
substr() 

Example:

Use strstr() to parse data out of a simple format
 <?php $quote = "A man cannot be comfortable without his own approval. --Mark Twain"; $separator = '--'; if ($remainer = strstr ($quote, $separator)) { echo 'The author for this quote was likely '", substr ($remainer, ...

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.