Try it.

But to answer your question, yes.  Don't forget to put quotes around your
strings in the case statements.

switch($name){
    case "beesly":
        break;
}


"Phantom" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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;
>      }
>  }
> ?>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to