php switch statements

PHP switch statement

The switch statement is used when we have multiple condition but only one condition true and only that code will be executed.
In other word we can say execute one of multiple blocks of code to be executed.

The switch statement works same as if-elseif-else statement.

PHP switch statement


switch (a)
case statement1:
if a=statement1 then code to be executed;
case statement2:
if a=statement2 then code to be executed;
case statement3:
if a=statement3 then code to be executed;
if “a” is not matches with any statement then code to be executed.


Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 9 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">