Showing posts with label switch statement. Show all posts
Showing posts with label switch statement. Show all posts

Monday, July 9, 2012

how to use the switch statement in php

switch statement can be extremely useful in complex situations.

switch($variable)
{
case "a":
        // run the code if $variable =  a .
break;
case "b":
        // run the code if $variable = b .
break;
case "c":
        // run the code if $variable = c .
break;
default:
        // run the code if $variable is not equal to either a,b or c
}