Switch statement

Steven J Lamb redhattedsheep at adiis.net
Mon Dec 12 17:55:29 UTC 2005


switch only checks to see if its equal. you could do  one of two things. put 
an if statement around your switch so that your switch only applies to day 
hours. or list out all of either the night cases or day cases and use the 
default case for everything you don't define. I hope this makes sense

Steven Lamb
----- Original Message ----- 
From: "Dotan Cohen" <dotancohen at gmail.com>
To: "For users of Fedora Core releases" <fedora-list at redhat.com>
Sent: Monday, December 12, 2005 11:47 AM
Subject: Switch statement


>I have no problem using the switch statement when I am checking if a
> variable equals a known number, like such:
>
> <?php
> switch ($hour) {
> case 0:
>   echo "Go to sleep.";
>   break;
> case 10:
>   echo "Good morning.";
>   break;
> case 22:
>   echo "Good night.";
>   break;
> }
> ?>
>
> However, how do I do it if the variable is larger than a certain
> number? For instance, I want to say "Good night" if $hour is greater
> than 22?
>
> Thanks in advance.
>
> Dotan Cohen
> http://lyricslist.com/lyrics/biography/327/martin_ricky.php
> Martin, Ricky Song Lyrics and Biography
>
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> 




More information about the fedora-list mailing list