PHP Switch Statement

Submitted by:Jhon Brain

Date added:04 March, 2012

Category:PHP

Use the switch statement to select one of many blocks of code to be executed.

Tags: php switch

Code Snippet:

<html>
<body>

<?php
$x=1;
switch ($x)
{
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>

</body>
</html>
 
 

Comments