案例:php案例     状态:不可编辑再运行    进入竖版
 运行结果 
x
 
1
2
3
4
<!DOCTYPE html>
5
<html>
6
<body>
7
8
<?php
9
$str = "This is nice";
10
echo strlen($str)."<br>"; // 使用 strlen() 来返回字符串长度
11
echo substr_count($str,"is")."<br>"; // 字符串中 "is" 出现的次数
12
echo substr_count($str,"is",2)."<br>"; // 字符串缩减为 "is is nice"
13
echo substr_count($str,"is",3)."<br>"; // 字符串缩减为 "s is nice"
14
echo substr_count($str,"is",3,3)."<br>"; // 字符串缩减为 "s i"
15
?>
16
  
17
</body>
18
</html>
19
20
21