Robert Cummings wrote:
On Tue, 2005-09-20 at 19:55, Thorsten Suckow-Homberg wrote:
I'm certain that is illegal.
Wanna bet? :)
$100... cuz I'm sure you didn't mean to compound those conditionals such
that PHP doesn't understand them ;)
Fair enough, but I believe it was the use of the switch statement for
that purpose that he was pointing out; with a few modifications it works
fine:
<?php
switch( true ) {
case ( 0 < $n && $n <= 4 ):
$f = 1;
break;
case ( 5 < $n && $n <= 7 ):
$f = 2;
break;
case ( 8 < $n && $n <= 12 ):
$f = 3;
break;
default:
$f = 4;
break;
}
?>
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php