Posted On: Mar 24, 2020
In PHP both functions are used to find the first occurrence of a substring in a string except
stristr() is case-insensitive and strstr is case-sensitive, if no match is found then FALSE will be returned.
<?php $email = ‘firstname.lastname@example.org’; $hostname = strstr($email, ‘@’); echo $hostname; output: @xyz.com ?>
stristr() does the same thing in Case-insensitive manner.
Never Miss an Articles from us.
In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type...