• 实例首页
  • 自学教程
  • IT工具箱
xxxxxxxxxx
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>PHP switch 循环 实例 - 自学教程(runoops.com)</title>
6
</head>
7
<body>
8
​
9
<?php
10
$favcolor="red";
11
switch ($favcolor)
12
{
13
case "red":
14
    echo "你喜欢的颜色是红色!";
15
    break;
16
case "blue":
17
    echo "你喜欢的颜色是蓝色!";
18
    break;
19
case "green":
20
    echo "你喜欢的颜色是绿色!";
21
    break;
22
default:
23
    echo "你喜欢的颜色不是 红, 蓝, 或绿色!";
24
}
25
?>
26
​
27
</body>
28
​
29
</html>

© 2023 自学教程   runoops.com All Rights Reserved. 备案号:闽ICP备19010956号-1