php switch case add if statement code example
Example 1: php switich
switch (n) {
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
case label3:
code to be executed if n=label3;
break;
...
default:
code to be executed if n is different from all labels;
}
Example 2: dualcase php switch
case 'car':
case 'ferrari':
print("car or ferrari");
break;