×
Create a new article
Write your page title here:
We currently have 3184 articles on s23. Type your article name above or click on one of the titles below and start writing!



s23
3184Articles
< PHP

A PHP function to compare strings case-sensitive. Also see stristr.

strstr

(PHP 3, PHP 4, PHP 5)

strstr -- Find first occurrence of a string

Description[edit]

string strstr ( string haystack, string needle )

Returns part of haystack string from the first occurrence of needle to the end of haystack.

If needle is not found, returns FALSE.

If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.

Note: This function is case-sensitive. For case-insensitive searches, use stristr(). 

<HighlightSyntax> <?php $email = 'user@example.com'; $domain = strstr($email, '@'); echo $domain; // prints @example.com ?> </HighlightSyntax>

Cookies help us deliver our services. By using our services, you agree to our use of cookies.