What is the functionality of the functions STRSTR() and STRISTR()?

Posted on

Both are used to find first accurance of the string ,The Difference is that-

strstr()-it is a case sensitive whereas stristr() is case insensitive

strstr() – Find first occurrence of a string(Case sensitive)
Syntax:
strstr ($string, string)

<?php
$email = ‘ravindra@tEst.com’;
$domain_name = strstr($email, ‘E’);
echo $domain_name;
?>

Output:Est.com

stristr() – Find first occurrence of a string (Case-insensitive)
Syntax:
stristr ($string, string)

Example:
<?php
$email = ‘ravendra@tEst.com’;
$domain_name = stristr($email, ‘E’);
echo $domain_name;

?>
Output: endra@tEst.com

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s