主页
PHP
PHP substr_count() 函数
tryphp_func_string_substr_count2
运行 ❯
×
更改方向
保存代码
更改主题
<?php $str = "This is nice"; echo strlen($str)."
"; // Using strlen() to return the string length echo substr_count($str,"is")."
"; // The number of times "is" occurs in the string echo substr_count($str,"is",2)."
"; // The string is now reduced to "is is nice" echo substr_count($str,"is",3)."
"; // The string is now reduced to "s is nice" echo substr_count($str,"is",3,3)."
"; // The string is now reduced to "s i" ?>