php中的substr_count函数的用法:【substr_count(string,substring,start,length)】。substr_count函数用于计算指定字串在字符串中出现的次数。

php substr_count函数用于统计一个字符串,在另一个字符串中出现次数,其语法是substr_count(string,substring,start,length),参数string 必需,是规定被检查的字符串;substring 必需,规定要搜索的字符串。

(推荐教程:php视频教程)

php substr_count函数怎么用?

作用:统计一个字符串,在另一个字符串中出现次数

语法:

substr_count(string,substring,start,length)

参数:

string 必需。规定被检查的字符串。

substring 必需。规定要搜索的字符串。

start 可选。规定在字符串中何处开始搜索。

length 可选。规定搜索的长度。

说明:

计算子串在字符串中出现的次数。子串是区分大小写的。该函数不计数重叠的子串。如果 start 参数加上 length 参数大于字符串长度,则该函数生成一个警告。

php substr_count()函数使用示例1

<?phpecho substr_count("I love php.I'm study in php.cn","php");?>

输出:

2

php substr_count()函数使用示例2

<?php $str = "This is php.cn test";echo substr_count($str,"is",3,9);?>

输出:

1

更多相关文章

  1. php中的array_merge函数怎么用
  2. php中的array_slice函数怎么用
  3. php中的array_shift函数怎么用
  4. php中的array_search函数怎么用
  5. php中的substr_replace函数怎么用
  6. php levenshtein函数怎么用
  7. php中的str_word_count函数怎么用
  8. php中的similar_text函数怎么用
  9. php中的count_chars函数怎么用

随机推荐

  1. Android多分辨率适配框架使用指南
  2. Android系统源码基础知识讲解
  3. Dagger 2 在 Android 上的使用(五)
  4. Dagger 2 在 Android 上的使用(四)
  5. [应用代码] android源码之多线程断点续传
  6. Android开发如何设置文字阴影
  7. 恶意吸费之后,你渴望开放还是开源?
  8. Android中的SQLite使用学习
  9. android 所有布局属性和UI控件
  10. (4) Android中Binder调用流程 --- bindServ