1
2<?php
3switch ($i) {
4 case 0:
5 echo "i equals 0";
6 break;
7 case 1:
8 echo "i equals 1";
9 break;
10 case 2:
11 echo "i equals 2";
12 break;
13 default:
14 echo "i is not equal to 0, 1 or 2";
15}
16?>
17
18
1<?php
2switch ($i) {
3 case "apple":
4 echo "i is apple";
5 break;
6 case "bar":
7 echo "i is bar";
8 break;
9 case "cake":
10 echo "i is cake";
11 break;
12}
13?>