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

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

substr_count



PHP substr_count() 函数

定义和用法

substr_count() 函数计算子串在字符串中出现的次数。


语法

substr_count(string,substring,start,length)


参数描述
string必需。规定要检查的字符串。
replacement必需。规定要插入的字符串。
start可选。规定在字符串中何处开始搜索。
charlist可选。规定搜索的长度。


例子

<?php
echo substr_count("Hello world. The world is nice","world");
?>

输出:

2



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

上一篇:substr_replace

下一篇:substr_compare

评论