You are here: Re: How to define a range in 'switch - case' « All PHP « IT news, forums, messages
Re: How to define a range in 'switch - case'

Posted by J.O. Aho on 10/12/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация