Re: professional code quick tip

From: Date: Wed, 21 Sep 2005 00:25:52 +0000
Subject: Re: professional code quick tip
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-222833@lists.php.net to get a copy of this message
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/

« previous php.general (#222833) next »