strstr and stristr are the same functionalites that used to find the first occurrence of the string.
Difference is strstr is used to find the first occurrence of the string with case sensitive but stristr is used for case-insensitive searches.
Syntex:
strstr($string , $needle string , $before needle);
$before needle :
If TRUE, strstr() returns the part of the haystack before the first occurrence of the needle.
Example :
<?php $email = 'name@example.com'; $domain = strstr($email, '@'); echo $domain; // prints @example.com $user = strstr($email, '@', true); // As of PHP 5.3.0 echo $user; // prints name ?>
0 comments:
Post a Comment