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

Thursday, May 4, 2017

Switch Statement in PHP

In this article I would like to share with you guys how to use switch statement in PHP. The code is very short and easy to understand. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Program Listing

<?php


$year_level = '4';


switch($year_level) {
case "1" :
   echo "Your are belong to Freshmen.";
break;
case "2" :
   echo "Your are belong to Sophomore.";
break;
case "3" :
   echo "Your are belong to Juniors.";
break;
case "4" :
   echo "Your are belong to Seniors.";
break;
default:
        echo "Invalid year level. Try again.";
}

?>