Home  >  Article  >  Backend Development  >  php判断字符串在另一个字符串位置的方法_PHP教程

php判断字符串在另一个字符串位置的方法_PHP教程

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

复制代码 代码如下:

$email='user@exe.com';        //定义字符串
$result=strstr($email,'@');         //返回子字符串
echo $result;

strstr()函数搜索一个字符串在另一个字符串中的第一次出现。

该函数返回字符串的其余部分(从匹配点)。如果未找到所搜索的字符串,则返回 false。

语法

复制代码 代码如下:


strstr(string,search)
输出结果"@exe.com"

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/736843.htmlTechArticle复制代码 代码如下: $email='user@exe.com'; //定义字符串 $result=strstr($email,'@'); //返回子字符串 echo $result; strstr()函数搜索一个字符串在另一个字符...
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