note 15929 added to control-structures.switch
| From: | t dot kloppenburg at billiton dot de | Date: | Tue, 09 Oct 2001 10:18:31 +0000 |
| Subject: | note 15929 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18714@lists.php.net to get a copy of this message | ||
I was searching for:
switch($var) {
case 1 : ... break;
case 2 : ... break;
case >2 : doesnotwork(); break;
}
But case can handle expressions, so
...
case ($var > 2): doit(); break;
...
works.
--
http://www.php.net/manual/en/control-structures.switch.php
http://master.php.net/manage/user-notes.php?action=edit+15929
http://master.php.net/manage/user-notes.php?action=delete+15929
http://master.php.net/manage/user-notes.php?action=reject+15929