PHP Learning : Switch - Publik Talk

Breaking

An informative website for every one.

Post Top Ad

Post Top Ad

Wednesday, August 2, 2017

PHP Learning : Switch

Description:

The switch statement is used to perform different actions based on different conditions.

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

Code:

<?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";
}
?>

output:


No comments:

Post a Comment

Post Top Ad