您现在的位置是:首页 > PHP函数

李清波 2015-10-01 PHP函数 1870 复制当前网址

strcspn



PHP strcspn() 函数

定义和用法

strcspn() 函数返回在找到任何指定的字符之前,在字符串查找的字符数。


语法

strcspn(string,char,start,length)


参数描述
string必需。规定要搜索的字符串。
char必需。规定要查找的字符。
start可选。规定开始查找的位置。该参数是 PHP 4.3 中新加的。
length可选。规定字符串的长度(搜索多少字符)。该参数是 PHP 4.3 中新加的。


提示和注释

注释:该函数是二进制安全的。


例子

<?php
echo strcspn("Hello world!","w");
?>

输出:

6


文章来源:http://liqingbo.com/blog-858.html

上一篇:strip_tags

下一篇:strcoll

评论