Thursday 11 February 2016

Switch Control Statement

Code:

<!DOCTYPE html>
<html>
<body>
<center>
<h1>Switch Control Statement</h1>
<?php
$color = "white";

switch ($color) {
    case "white":
        echo "Your favorite color is white!";
        break;
    case "blue":
        echo "Your favorite color is blue!";
        break;
    case "green":
        echo "Your favorite color is green!";
        break;
    default:
        echo "Your favorite color is neither white, blue, nor green!";
}
?>
</center>
</body>
</html>


Output:

 

No comments:

Post a Comment