<?php
$str
=
"This is nice"
;
echo
strlen
(
).
"<br>"
// 使用 strlen() 来返回字符串长度
substr_count(
,
"is"
// 字符串中 "is" 出现的次数
,2).
// 字符串缩减为 "is is nice"
,3).
// 字符串缩减为 "s is nice"
,3,3).
// 字符串缩减为 "s i"
?>
特例:
"abcabcab"
"abcab"
);
// 此函数不会对重叠的子字符串计数