note 97700 added to control-structures.switch
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 04 May 2010 03:04:27 +0000 |
| Subject: | note 97700 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168900@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 38.127.225.193
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- https://master.php.net/note/edit/97700
Del: integrated -- https://master.php.net/note/delete/97700/integrated
Del: useless -- https://master.php.net/note/delete/97700/useless
Del: bad code -- https://master.php.net/note/delete/97700/bad+code
Del: spam -- https://master.php.net/note/delete/97700/spam
Del: non-english -- https://master.php.net/note/delete/97700/non-english
Del: in docs -- https://master.php.net/note/delete/97700/in+docs
Del: other reasons-- https://master.php.net/note/delete/97700
Reject -- https://master.php.net/note/reject/97700
Search -- https://master.php.net/manage/user-notes.php