Learn PHP Switch 

It is same like If else statement . In PHP switch statement , it execute single statement from multiple conditions .

For example 

<?php 

switch(expression)
{      
   case value1:    
   break;  

   case value2:    
   break;  
 
// It execute the matching result   
}  

?>
 

Now let me give you one example  of switch statement with output :

Suppose $i = cake :

<?php
switch ($i) {
    case "apple":
        echo "i is apple";
        break;
    case "bar":
        echo "i is bar";
        break;
    case "cake":
        echo "i is cake";
        break;
}
?>


Guess what will be output ?

You are right : cake 

so easy right ? :)



TO know more see this video :



Last Updated: 2018-07-06 12:32:44 By akshay

SHARE THIS

share_facebook share_twitter share_google_plus

Please Comment Here :