PHP Switch Statement

PHP
[HYPERTEXT PREPROCESSOR]
PHP (Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.Originally created by Rasmus Lerdorf in 1994.
PHP code may be embedded into HTML code, or it can be used in combination with various web templates. PHP code may also be executed with a command-line interface (CLI) and can be used to implement standalone graphical applications.
                               
Switch  Statement:
The switch statement is to select one of many blocks of code to be executed.
Syntax
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;
}


Program:

OUTPUT:

Content Writer:
Er. Vishwadeep Damodare
CSE Vth Sem
TSPC, Burhanpur

Related topics

Professor Jayesh video tutorial

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.