note 18819 added to control-structures.switch
| From: | (spamme) | Date: | Wed, 06 Feb 2002 17:55:59 +0000 |
| Subject: | note 18819 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26304@lists.php.net to get a copy of this message | ||
Along the lines of using expressions in switch statements. I came across some code which wrapped
switch statements in 'if' blocks like so...
if (isset($var) {
switch($var) {
....
But I found the following a little cleaner.
switch ( isset($var) ? $var : defaultValue ) {
...
--
http://www.php.net/manual/en/control-structures.switch.php
http://master.php.net/manage/user-notes.php?action=edit+18819
http://master.php.net/manage/user-notes.php?action=delete+18819
http://master.php.net/manage/user-notes.php?action=reject+18819