Switch


Switch1.php
<html>
<title>switch1</title>
</head>

<body>


<?php

$giftdollars
=500;

switch (
$giftdollars)
    {
        case 
50:  
        case 
100
            print(
"I can buy shoes!");
            break;

        case 
200
            print(
"I can buy shoes and an outfit!");
            break;

        case 
300
            print(
"I can buy shoes, an outfit, and tickets to a play!");
            break;

        case 
400
            print(
"I can buy shoes, an outfit, tickets to a play, and a weekend getaway!");
            break;

        default:
            print(
"I'm buying a Playstation 3 to use as a footrest while playing my XBox 360!");
    }
?>

</body>
</html>

Switch2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Switch2</title>
</head>

<body>

<p>A Web 2 student (I prefer not to use his name) was caught ditching again and has begged to make up his exam.
Because I am such a kind and caring teacher, I have allowed Travis to take his exam after school.  Here is his score:  
</p> 

<p>Travis 89.9</p>



<p>Let's use PHP to display Travis's grade after the ditching adjustment:</p>
<?php
$travisscore
=89.9;
$travisgrade="A"



switch(
$travissscore)
{
case (
$travissscore 60):
    
$travissgrade="F";
    break;
case (
$travissscore 70):
    
$travissgrade="D";
    break;
case (
$travissscore 80):
    
$travissgrade="C";
    break;
case (
$travissscore 90):
    
$travissgrade="B";
    break;
default:
    
$travissgrade="A";
}

$travissgrade "F"//ha ha

echo "<strong>Travis, you didn't do very well on your test.  You got an "$travissgrade .".</strong>";

?>








</body>
</html>