1switch (fruit) {
2 case apple:
3 code to be executed if fruit=apple;
4 break;
5 case banana:
6 code to be executed if fruit=banana;
7 break;
8 ...
9 default:
10 code to be executed if fruit is different from all fruits;
11}
1switch ($i) {
2 case 0:
3 echo "i equals 0";
4 break;
5 case 1:
6 echo "i equals 1";
7 break;
8 case 2:
9 echo "i equals 2";
10 break;
11 default:
12 echo "i is not equal to 0, 1 or 2";
13}
1switch (n) {
2 case label1:
3 code to be executed if n=label1;
4 break;
5 case label2:
6 code to be executed if n=label2;
7 break;
8 case label3:
9 code to be executed if n=label3;
10 break;
11 ...
12 default:
13 code to be executed if n is different from all labels;
14}