Home »

What is the functionality of the function strstr and stristr?

Question ListCategory: PHPWhat is the functionality of the function strstr and stristr?
jamessmith05 author asked 9 years ago
3 Answers
alisataylore190 author answered 8 years ago

strstr:Returns part of haystack string from the first occurrence of needle to the end of haystack.If needle is not found, returns FALSE. If needle is not a string, it is converted to an integer and applied as the ordinal value of a character. This function is case-sensitive. For case-insensitive searches, use stristr().

jully882 author answered 8 years ago

strstr Returns part of string from the first occurrence of needle(sub string that we finding out ) to the end of string.$email= ‘sonialouder@gmail.com’;
$domain = strstr($email, ‘@’);
echo $domain; // prints @gmail.com
here @ is the needlestristr is case-insensitive means able not able to diffrenciate between a and A

ethanbrown author answered 8 years ago

strstr() returns part of a given string from the first occurrence of a given substring to the end of the string.
For example: strstr(“user@example.com”,”@”) will return “@example.com”.stristr() is idential to strstr() except that it is case insensitive.

Please login or Register to Submit Answer