note 88360 rejected from control-structures.switch by danbrown
| From: | danbrown@php.net | Date: | Wed, 21 Jan 2009 11:57:19 +0000 |
| Subject: | note 88360 rejected from control-structures.switch by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149587@lists.php.net to get a copy of this message | ||
Note Submitter: seibermaki at gmail dot com
----
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?