Home  >  Article  >  Backend Development  >  PHP method to determine the position of a string in another string_PHP tutorial

PHP method to determine the position of a string in another string_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:36:52798browse

Copy code The code is as follows:

$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 matching point). Returns false if the searched string is not found.

Syntax

Copy code The code is as follows:


strstr(string,search)
Output result "@exe.com"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/736843.htmlTechArticleCopy the code as follows: $email='user@exe.com'; //Define string $result= strstr($email,'@'); //Return substring echo $result; The strstr() function searches a string within another character...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn