Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, April 18, 2013

Codecademy Sample Solution: Using "Endswitch". Syntactic Sugar!



<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
    <?php
    $i = 5;
   
    switch ($i):
        case 0:
            echo '$i is 0.';
            break;
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
            echo '$i is somewhere between 1 and 5.';
            break;
        case 6:
        case 7:
            echo '$1 is either 6 or 7.';
            break;
        default:
            echo "I don't know how much \$i is";
            break;
    endswitch;
    ?>
    </body>
</html>

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts