note 53726 added to control-structures.switch
| From: | grins1athotmaildotcom at osu1 dot php dot net | Date: | Fri, 10 Jun 2005 17:40:16 +0000 |
| Subject: | note 53726 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90234@lists.php.net to get a copy of this message | ||
Just so its out here for all to see, a way to check for multiple conditions per case using the
example from 04-Jun-2005 03:24:
switch ($month_name) {
case ($month_name === "Jan" || $month_name === "January"):
$month = "1";
break;
}
With or without the parenthesis is fine.
I wasn't sure until I went through the motions and played around with it.
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53726
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53726&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53726&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53726&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53726&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53726&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53726&report=yes
Search -- http://master.php.net/manage/user-notes.php