note 93722 added to control-structures.break
| From: | t dot koehn at it-group dot org | Date: | Thu, 24 Sep 2009 12:53:51 +0000 |
| Subject: | note 93722 added to control-structures.break | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161016@lists.php.net to get a copy of this message | ||
To webmaster at kayfer dot com:
You made some big mistakes in your switch loop.
First of all, not Checking if $_GET[ "id" ] is really set is the worst, with the wrong
Error level it will throw out Notes everywhere which (mostly) destroy the layout and are annoying
<?php
switch( isset( $_GET[ "id" ] ) ? $_GET[ "id" ] : "default" ) )
?>
should fix this
Next thing,
you used Constants in your case's, not strings at all
<?php
case "banner":
case "header":
case "other":
?>
Your way will work, but as soon as you defined those constants ( define( "banner",
"foo" ) ) your switch won't work anymore
----
Server IP: 69.147.83.197
Probable Submitter: 80.152.175.254
----
Manual Page -- http://www.php.net/manual/en/control-structures.break.php
Edit -- https://master.php.net/note/edit/93722
Del: integrated -- https://master.php.net/note/delete/93722/integrated
Del: useless -- https://master.php.net/note/delete/93722/useless
Del: bad code -- https://master.php.net/note/delete/93722/bad+code
Del: spam -- https://master.php.net/note/delete/93722/spam
Del: non-english -- https://master.php.net/note/delete/93722/non-english
Del: in docs -- https://master.php.net/note/delete/93722/in+docs
Del: other reasons-- https://master.php.net/note/delete/93722
Reject -- https://master.php.net/note/reject/93722
Search -- https://master.php.net/manage/user-notes.php