php 字符串里包含某个字符多少个,包含某个字符个数

方法一:substr_count()函数是一个小字符串在一个大字符串中出现的次数:

$number = substr_count($big_string, $small_string);

方法二:用explode进行判断PHP判断字符串里包含某个字符多少个,代码如下:

$tmp = explode($big_string,$small_string);

$number = count($tmp);

php 字符串里包含某个字符多少个,包含某个字符个数方法一:substr_count()函数是一个小字符串在一个大字符串中出现的次数:$number = substr_count($big_string, $small_string);

方法二:用explode进行判断PHP判断字符串里包含某个字符多少个,代码如下:$tmp = explode($big_string,$small_string);$number = count($tmp);

查看原文