note 31551 added to control-structures.switch
| From: | i at rack1 dot php dot net | Date: | Fri, 25 Apr 2003 16:46:18 +0000 |
| Subject: | note 31551 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47088@lists.php.net to get a copy of this message | ||
Noticed some odd switch behavior worth mentioning:
Switching on a variable set as $var="08" and forgetting the quotes within the case results
in different behavior depending on the two digit number the variable is set to.
For "01" to "07", using a case like
case 01:
the case is triggered.
For "08" or "09" the case is skipped.
For "10" to "12" the case is triggered.
Looks like something octal may be going on.
Anyway, not a problem once the case is changed to:
case "08":
as it should have been from the start. Just odd.
--
http://www.php.net/manual/en/control-structures.switch.php
http://master.php.net/manage/user-notes.php?action=edit+31551
http://master.php.net/manage/user-notes.php?action=delete+31551
http://master.php.net/manage/user-notes.php?action=reject+31551