Re: professional code quick tip

From: Date: Tue, 20 Sep 2005 23:47:48 +0000
Subject: Re: professional code quick tip
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-222826@lists.php.net to get a copy of this message
in other languages it is possible use conditional epression in switch case like switch $n case (0<n<=4): ........ but no in php
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; } ?>

« previous php.general (#222826) next »