Home  >  Article  >  php教程  >  php 判断字符串在另一个字符串中位置

php 判断字符串在另一个字符串中位置

WBOY
WBOYOriginal
2016-05-24 09:00:071064browse

strstr() 函数搜索一个字符串在另一个字符串中的第一次出现,该函数返回字符串的其余部分,从匹配点,如果未找到所搜索的字符串,则返回 false.

语法:strstr(string,search),实例代码如下:

//输出结果"@example.com" 
$email='user@example.com';        //定义字符串 
$result=strstr($email,'@');         //返回子字符串 
echo $result; //开源代码phprm.com 
/*

   


本文链接:

收藏随意^^请保留教程地址.

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