PHP Switch


PHP Switch Statement

Switch statement is used to compare conditions with different values.
<?
$age = 2;
switch ($age) {
       case 1:
             echo "The baby was still very small";
             break;
       case 2:
             echo "The baby was already very lively";
             break;
       case 3:
             echo "The boy was already apparent intelligence";
             break;
       case 4:
             echo "The boy was very happy to enter kindergarten";
}
?>

0 comments:

Post a Comment