Re: Case Statements - lil help please

From: Date: Sun, 31 Mar 2002 05:38:45 +0000
Subject: Re: Case Statements - lil help please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90864@lists.php.net to get a copy of this message
Try the following... // check the error code and generate an appropriate error message switch($e) { case( -1): $message = "No such user."; break; case(0): $message = "Invalid username and/or password."; break; case(2): $message = "Unauthorized access."; break; default: $message = "An unspecified error occurred."; break; } ----- Original Message ----- From: "Patrick Hartnett" <irishprogramming@hotmail.com> To: <php-general@lists.php.net> Sent: Sunday, March 31, 2002 12:03 AM Subject: [PHP] Case Statements - lil help please > Are case statements not implemented in PHP4? > > If so, can someone help me debug this one, I seem to have some syntax > incorrect, and am not sure what exactly is wrong with the statement. I get > a parse error on the first line, but can't find any documentation on case > statements in PHP4, so I am kinda stuck. > thanks > -Patrick > > ############# > > > // check the error code and generate an appropriate error message switch > ($e) { > case -1: > $message = "No such user."; > break; > > case 0: > $message = "Invalid username and/or password."; > break; > > case 2: > $message = "Unauthorized access."; > break; > > default: > $message = "An unspecified error occurred."; > break; > } > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: > http://mobile.msn.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#90864) next »