Re: weird switch behaviour
| From: | Miles Thompson | Date: | Thu, 26 Jun 2003 17:03:19 +0000 |
| Subject: | Re: weird switch behaviour | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153010@lists.php.net to get a copy of this message | ||
Try cleaning it up ...
switch( trim( strtoupper( $type ) ) );
I had this happen to me - the $type echoed OK, but would not get caught in the "case". The above fixed it.
Miles Thompson
At 02:18 PM 6/18/2003 +0100, cg wrote:
I am testing a var in a switch statement,
switch($type)
{
case "HIRE":
statements;
break;
etc....
default:
echo "In Default";
break;
}
I can echo $type directly above the switch statement, confirm it contains
the string "HIRE", but the switch takes the default every time!!
what is going on??
thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php