Re: professional code quick tip
| From: | Jasper Bryant-Greene | Date: | Wed, 21 Sep 2005 00:05:11 +0000 |
| Subject: | Re: professional code quick tip | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222831@lists.php.net to get a copy of this message | ||
Robert Cummings wrote:
On Tue, 2005-09-20 at 19:47, Thorsten Suckow-Homberg wrote:I don't think so, although I'm not able to test it right at this second. PHP compares the value within the switch statement to the value at each case. Only the case which is true will match true inside the switch statement, so it should actually work as intended. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/You could use the following statement: <?php switch (true) { case (0 < $n <= 4): $f = 1; break; case (5 < $n <= 7): $f = 2; break; case (8 < $n <= 12): $f = 3; break; default: $f = 4; break; }I'm certain that is illegal.