note 76440 added to control-structures.switch
| From: | Drake at osu1 dot php dot net | Date: | Mon, 16 Jul 2007 05:51:16 +0000 |
| Subject: | note 76440 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128607@lists.php.net to get a copy of this message | ||
Also,
when using switch for mode selecting on websites like:
switch($_GET['mode']) {
case "gallery":
//code
break;
case "news":
//code
break;
case "stuff":
//code
break;
default, etc etc
}
Will NOT trigger the string == 0 bug, because $_GET automatically parse anything passed to them as
strings.
(same applies for all browser variables: SESSION, POST etc)
so passing:
mode=0
into the address bar is the same as:
$_GET['mode'] = "0"; //not $_GET['mode'] = 0;
thought it may help.
----
Server IP: 203.202.10.60
Probable Submitter: 202.136.35.210
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- https://master.php.net/note/edit/76440
Del: integrated -- https://master.php.net/note/delete/76440/integrated
Del: useless -- https://master.php.net/note/delete/76440/useless
Del: bad code -- https://master.php.net/note/delete/76440/bad+code
Del: spam -- https://master.php.net/note/delete/76440/spam
Del: non-english -- https://master.php.net/note/delete/76440/non-english
Del: in docs -- https://master.php.net/note/delete/76440/in+docs
Del: other reasons-- https://master.php.net/note/delete/76440
Reject -- https://master.php.net/note/reject/76440
Search -- https://master.php.net/manage/user-notes.php