note 52853 deleted from control-structures.switch by tularis
| From: | tularis@php.net | Date: | Sun, 15 May 2005 09:35:22 +0000 |
| Subject: | note 52853 deleted from control-structures.switch by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-89446@lists.php.net to get a copy of this message | ||
Note Submitter: sadmac at earthlink dot net
Reason: useless
----
To clarify, if you put more than one case for the same value into the switch statement, execution
will begin at the first instance of the value, and end with the first break encountered.
<?php
$j = 0;
switch($j)
{
case 0:
echo "part one";
break;
case 1:
//blah blah blah
break;
case 0:
echo "part two";
break;
}
?>
would output only "part one". In some ways it would seem intuitive that "part onepart
two" would get outputted,and in some ways it makes sense as is.