note 97701 deleted from control-structures.switch by danbrown
| From: | danbrown@php.net | Date: | Tue, 04 May 2010 14:17:19 +0000 |
| Subject: | note 97701 deleted from control-structures.switch by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168927@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Hi,
A simple illustration, I had to re-read the documentation to get it :P
$var = 0;
switch ($var) {
case ($var == 1 || $var == -1):
echo 'Its 1 or -1;
break;
default:
echo 'Its NOT 1 or -1';
break;
}
Output: Its 1 or -1
$var = 0;
switch ($var) {
case -1:
case 1:
echo 'Its 1 or -1;
break;
default:
echo 'Its NOT 1 or -1';
break;
}
Output: Its NOT 1 or -1