Source Code illustrating use of switch case statement in php:-
/********************************************************************************/
<html>
<head>
<title>constants</title>
</head>
<body>
<?php
$a=3.3;
switch($a)
{
case
1:
echo"a
is equal to 1";
break;
case
2:
echo"a
is equal to 2";
break;
case
3:
echo"a
is equal to 3";
break;
case
4:
echo"a
is equal to 4";
break;
default
:
echo"a
is something else";
}
?>
</body>
</html>
/*******************************************************************************/The statements in the default clause are executed only when none of the value in the case is matched.
No comments:
Post a Comment