Posted by J.O. Aho on 10/03/45 11:37
Stefan Mueller wrote:
> How do I have to define a range in 'case'? I tried '> 0' but it's not
> working.
>
> switch ($my_number) {
> case 0:
> ...
> break;
>
> case > 0:
> ...
> break;
> }
switch($your_number) {
case 0:
/* $your_number==0 */
break;
case 1:
case 2:
case 3:
/* $your_number >= 1 && $your_number <= 3 */
default:
/* for everything else */
break;
}
If this isn't what you wish, then use the standard if-statement.
//Aho
Navigation:
[Reply to this message]
|