The usage method is introduced below:
1. strstr: Returns a string from the beginning to the end of the judged character. If there is no return value, it does not contain
Copy code The code is as follows:
/*As shown in the manual*/
$email = 'user@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
?> ;
Copy the code The code is as follows:
$str= 'abc';
$needle= 'a';
$pos = strpos($str, $needle);
Copy the code The code is as follows:
function checkstr($str){
$needle = "a";//Determine whether the character a is included
$tmparray = explode($needle,$str);
if(count($tmparray)>1){
return true;
} else{
return false;
}
}
The above introduces how to intercept strings, PHP determines characters and the containing method attributes of strings, including the content of intercepting strings. I hope it will be helpful to friends who are interested in PHP tutorials.