note 65307 deleted from control-structures.switch by bjori
| From: | bjori@php.net | Date: | Fri, 28 Apr 2006 14:23:07 +0000 |
| Subject: | note 65307 deleted from control-structures.switch by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109985@lists.php.net to get a copy of this message | ||
Note Submitter: php at jast dot heapsort dot de
----
In response to mark at softmedia4u dot com:
This example is using bare words instead of strings, so while a is converted into the string
'a', b-a is converted into 'b'-'a' at which point the strings are
converted to numbers (0) and the whole thing ends up reading 'case 0'. If you compare a
string with 0 that doesn't start with digits, you always get a match, so this is, in fact, not
behaviour equivalent to 'default'.
You probably want to use case 'b-a'.