Using strings in switches

From: Date: Wed, 06 Feb 2002 06:39:37 +0000
Subject: Using strings in switches
Groups: php.general 
Request: Send a blank email to php-general+get-83676@lists.php.net to get a copy of this message
The manual shows that you can use switches with numeric values but is it also possible to use strings? Is this possible? If not, what can I do? Just a bunch of if statements? <? if (isset($Name)) { switch ($Name) case Homer Simpson: echo "DO'H!!!!<p>"; break; case Fred Flinstone: echo "Yabba Dabba Do<p>"; break; default: echo "Do not know you<p>"; break; } } ?>

« previous php.general (#83676) next »