php determines the position of a string in another string

  • 2021-01-19 22:03:47
  • OfStack


$email='user@exe.com';        // Define string 
$result=strstr($email,'@');         // Return substring 
echo $result; 

The strstr() function searches for the first occurrence of a string in another string.

This function returns the rest of the string (from the match point). If the searched string is not found, false is returned.

grammar



strstr(string,search)
The output is "@exe.com"


Related articles: