1$age=20;
2switch ($age) {
3 case 19:
4 echo "Age is 18";
5 break;
6 case 20:
7 echo "Age is 20";
8 break;
9 case 21:
10 echo "Age is 21";
11 break;
12}
1foreach ($array[0] as $key => $value) {
2 switch ($key) {
3 case 'Products' :
4 // do something
5 break ;
6 case 'customers' :
7 // do something
8 break ;
9 case 'Models' :
10 // do something
11 break ;
12 }
13 }