PHP Switch Case Statement Syntax and Example
This statement is used if one needs to select one from multiple options. PHP Switch Case Syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | switch (x) { case label1: code to be executed if x=label1; break; case label2: code to be executed if x=label2; break; case label3: code to be executed if x=label3; break; ... default: code to be executed if x is different from all labels; } |
PHP switch case is used to select one among multiple options. inside switch we can use expression or value inside switch there can be multiple case statement with different case value. case value must be constant. break … Read more