小白教程
所有教程
关于
Search
172.71.254.94
172.71.254.94
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func string strcspn”的源代码
本页内容
上一节:
Func_string_strcoll
下一节:
Func_string_strip_tags
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:strcspn()}}[[分类:PHP字符串函数参考手册|65]] = PHP strcspn() 函数 = [[:分类:PHP字符串函数参考手册]] 输出在字符串 "Hello world!" 中找到字符 "w" 之前查找的字符数: <sample title="" desc="" lang="php" hererun="1"> <?php echo strcspn("Hello world!","w"); ?> </sample> == 定义和用法 == strcspn() 函数返回在找到任何指定的字符之前,在字符串查找的字符数(包括空格)。 '''提示:''' Use the [[func string strspn|strspn()]] function to the number of characters found in the string that contains only characters from a specified character list. '''注释:''' This function is binary-safe. == 语法 == <pre> strcspn(string,char,start,length) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | string | 必需。规定要搜索的字符串。 |- | char | 必需。规定要查找的字符。 |- | start | 可选。规定开始查找的位置。 |- | length | 可选。规定字符串的长度(搜索多少字符)。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | 返回在找到任何指定的字符之前,在字符串查找的字符数。 |- | PHP 版本: | 4+ |- | 更新日志: | 在 PHP 4.3 中,新增了 start 和 length 参数。 |} == 更多实例 == == 实例 1 == 使用所有的参数来输出在字符串 "Hello world!" 中找到字符 "w" 之前查找的字符数: <sample title="" desc="" lang="php" hererun="1"> <?php echo strcspn("Hello world!","w",0,6); // The start position is 0 and the length of the search string is 6. ?> </sample> [[:分类:PHP字符串函数参考手册]]
返回至“
Func string strcspn
”。
上一节:
Func_string_strcoll
下一节:
Func_string_strip_tags