Tutorials for PHP “Switch Case” Condition

What is “The switch Statement”?

The assertion (Switch) looks like a series of declarations that all say the same thing. To select one of the numerous executable code blocks, use the term (Switch).

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;
}
PHP Switch - javatpoint

Example1:-

Output:-

Example2:-

Output:-

Example3:-

Output:-

Tagged : / / / / / / / / /