Difference between strstr() and stristr() functions in PHP.

By | August 2, 2011

Both functions are used to return or finds the first occurence of a substring from a string, and give all string from first occurence to end of string except than stristr() is case-insensitive.
If no match is found then FALSE will be returned.
Example

 
$email = 'abc@xyz.com';
 
$host = strstr($email, '@');
 
echo $host;
 
output: @xyz.com

stristr() does the same thing in Case-insensitive manner

Leave a Reply

Your email address will not be published. Required fields are marked *