note 88360 added to control-structures.switch

From: Date: Wed, 21 Jan 2009 09:47:37 +0000
Subject: note 88360 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-149579@lists.php.net to get a copy of this message
switch isn't working for me at all. My website is setup using switch, but when I put all the files on my other webhost, the switch doesn't function at all. The only difference is the version of PHP that is running. The server where the switch works, is running PHP 4.4.2 The server where the switch doesn't work is running PHP 5.2.5 I've also tried on my laptop running the newest apache and php, but switch still doesn't work. Here's a bit of code I am using: <?php switch($id) { case 'a': echo 'case is a'; break; case 'b': echo 'case is b'; break; case 'c': echo 'case is c'; break; case 'd': echo 'case is d'; break; default: echo 'default'; } ?> The way I am accessing it is like so: index.php?id=b which should give me "case is b", but instead it just gives me the default. Any suggestions? ---- Server IP: 64.71.164.2 Probable Submitter: 99.170.64.244 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/88360 Del: integrated -- https://master.php.net/note/delete/88360/integrated Del: useless -- https://master.php.net/note/delete/88360/useless Del: bad code -- https://master.php.net/note/delete/88360/bad+code Del: spam -- https://master.php.net/note/delete/88360/spam Del: non-english -- https://master.php.net/note/delete/88360/non-english Del: in docs -- https://master.php.net/note/delete/88360/in+docs Del: other reasons-- https://master.php.net/note/delete/88360 Reject -- https://master.php.net/note/reject/88360 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149579) next »