note 47268 added to control-structures.switch
| From: | jserdy at z7q2 dot com | Date: | Tue, 09 Nov 2004 17:16:37 +0000 |
| Subject: | note 47268 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80313@lists.php.net to get a copy of this message | ||
Entirely by accident, I discovered that both semi-colons and colons work at the end of case
statements:
<?
$test = "2";
switch ( $test ) {
case "1";
echo "one";
break;
case "2";
echo "two";
break;
default;
echo "other than one or two";
break;
}
switch ( $test ) {
case "1":
echo "one";
break;
case "2":
echo "two";
break;
default:
echo "other than one or two";
break;
}
?>
I will guess this is a feature (at least for 4.3.4)
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47268
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47268&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47268&report=yes
Search -- http://master.php.net/manage/user-notes.php