定义和用法
strpos() 函数查找字符串在另一字符串中第一次出现的位置(区分大小写)。
注释:strpos() 函数是区分大小写的。
注释:该函数是二进制安全的。
相关函数:
strrpos() 查找字符串在另一字符串中最后一次出现的位置(区分大小写)
stripos() 查找字符串在另一字符串中第一次出现的位置(不区分大小写)
strripos() 查找字符串在另一字符串中最后一次出现的位置(不区分大小写)
语法
strpos(string,find,start)
参数 描述
string 必需。规定被搜索的字符串。
find 必需。规定要查找的字符。
start 可选。规定开始搜索的位置。
示例:
<?php
$str = "The strpos () function returns the first occurrence of a string in another string.";
echo strpos($str,"the");
?>
输出:
31
原文链接:https://www.qiquanji.com/post/8550.html
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注
更新实时通知