NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# PHP substr_count() 函数 ## 定义和用法 substr_count() 函数计算子串在字符串中出现的次数。 ### 语法 ``` substr_count(_string_,_substring_,_start_,_length_) ``` | 参数 | 描述 | | --- | --- | | _string_ | 必需。规定要检查的字符串。 | | _substring_ | 必需。规定要检索的字符串。 | | _start_ | 可选。规定在字符串中何处开始搜索。 | | _length_ | 可选。规定搜索的长度。 | ## 例子 ``` <?php echo substr_count("Hello world. The world is nice","world"); ?> ``` 输出: ``` 2 ```