#49993 [Bgs]: switch: default is triggering every time
| From: | sworddragon2 at aol dot com | Date: | Mon, 26 Oct 2009 00:27:11 +0000 |
| Subject: | #49993 [Bgs]: switch: default is triggering every time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143946@lists.php.net to get a copy of this message | ||
ID: 49993
User updated by: sworddragon2 at aol dot com
Reported By: sworddragon2 at aol dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP Professional SP3
PHP Version: 5.3.0
New Comment:
I have allready read the documentation. Maybe it's a misunderstanding
because the switch documentation isn't translated in my language but the
documentation says the following:
A special case is the default case. This case matches anything that
wasn't matched by the other cases. For example:
If this issue is working correctly the documentation is wrong i think.
Previous Comments:
------------------------------------------------------------------------
[2009-10-25 23:35:50] rasmus@php.net
Please read the documentation on switch/case (for any language)
carefully. This is expected behaviour. Hint, read about "break".
------------------------------------------------------------------------
[2009-10-25 23:33:08] sworddragon2 at aol dot com
Description:
------------
In this example default is triggering although the case statement is
triggering before.
Reproduce code:
---------------
switch(1)
{
case 1: echo "case 1: triggered\n";
default: echo 'default: triggered';
}
Expected result:
----------------
case 1: triggered
Actual result:
--------------
case 1: triggered
default: triggered
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49993&edit=1