Switch Statement in PHP

Switch Statement in PHP

<?php
$var=3; // Assings 1 to variable var
switch($var)// Switch statement that takes an argument
{
case 1:      // If the value of var is 1
echo ” This is 1″; // this statement will be executed
break;

case 2:      // If the value of var is 2
echo ” This is 2″; // this statement will be executed
break;
case 3:      // If the value of var is 3
echo ” This is 3″; // this statement will be executed
break;
}
_____________________________________________________________
For output and program execution see the video

 

Leave a Comment

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

©Postnetwork-All rights reserved.