无涯教程-PHP - substr_count函数

50 阅读1分钟

substr_count - 语法

substr_count(string,substring,start,length)

它用于计算子字符串的数量

Sr.No 参数 & Description
1

string

用于指定要检查的字符串

2

substring

它用于指定搜索的字符串

3

start

它指定在字符串中何时开始搜索

4

length

它指定字符串的长度

substr_count - 返回值

它返回字符串在字符串中出现的次数

substr_count - 示例

<?php
   echo substr_count("sairamkrishna","krishna");
?>

这将产生以下输出-

1

参考链接

www.learnfk.com/php/php-fun…