最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php substr_count字符出现次数统计函数
时间:2011-10-14 编辑:简简单单 来源:一聚教程网
substr_count(string,substring,start,length)
参数 描述
string 必需。规定要检查的字符串。
substring 必需。规定要检索的字符串。
start 可选。规定在字符串中何处开始搜索。
length 可选。规定搜索的长度。
代码如下 | 复制代码 |
$str="ni hao ,wo jiao wang hui ,lai zi an hui chao hu"; echo "原字符串:".$str." $str1=substr_count($str,'i');//substr_count():统计字符串在函数中出现的次数 echo "使用substr_count()之后:".$str1." $str2=substr_count($str,'i',6);//substr_count($str,'i',6):从第6个字符串开始统计,后面还跟数字的话,就是统计多少个,如果不加的话,默认是到最后 echo "使用substr_count()之后:".$str2." ?> |
相关文章
- php 字符替换函数 substr_replace 与 str_replace 用法 08-07
- php中查找字符吕函数之strstr,strpos,substr,strrchr介绍 06-09
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31