note 93722 deleted from control-structures.break by danbrown

From: Date: Thu, 24 Sep 2009 17:36:36 +0000
Subject: note 93722 deleted from control-structures.break by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161023@lists.php.net to get a copy of this message
Note Submitter: t dot koehn at it-group dot org ---- 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

« previous php.notes (#161023) next »