Powered by Blogger.

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


Both functions are used to return or find the first occurrence of a substring from a string, and give all string from the first occurrence 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

No comments