企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 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 ```