note 57955 deleted from control-structures.alternative-syntax by mgf
| From: | mgf@php.net | Date: | Thu, 28 Aug 2008 12:43:43 +0000 |
| Subject: | note 57955 deleted from control-structures.alternative-syntax by mgf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143916@lists.php.net to get a copy of this message | ||
Note Submitter: davidforest at gmail dot com
----
If you need a tidy way to do a lot of condition testing, switch statement will do the job well:
switch (true){
case ($a>0):
//do sth;
break;
case ($b>0):
//do sth;
break;
case ($c>0):
//do sth;
break;
case ($d>0):
//do sth;
break;
}