What is difference between strstr() and stristr() function ?
Last updated 5 years, 5 months ago | 2779 views 75 5
strstr() and stristr()
strstr() and stristr() both are use to find first occurence of a string, but the differences are strstr( ) is case sensitive where as stristr( ) is case insensitive.
strstr() – Find first occurrence of a string
strstr ($string, string)
<?php
$email = 'raghav@yaHoo.com';
$str = strstr($email, 'H');
echo $str;
?>
// Output will be Hoo.com
stristr() – Find first occurrence of a string (Case-insensitive)
stristr ($string, string)
<?php
$email = 'raghav@yaHoo.com';
$str = stristr($email, 'H');
echo $str;
?>
// Output will be hov@yaHoo.com