PHP » Strings » strstr()

Syntax:
string strstr(string s, string search)
s
String to search in.
search
Character sequence to search for.

Returns part of a string based on a search.

strstr() searches a string for the first occurrence of another string, and returns a string with the characters to the right of the first occurrence. If no occurrence is found, FALSE is returned.

Examples

Code:
<?php

print strstr("http://www.devguru.com", "www");

?>
Output:
www.devguru.com
Explanation:

strstr() is used on a web URL to return the part after the protocol.

See Also: