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:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x