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

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: