RE: [PHP] ifelse/else
| From: | Mohit Mittal | Date: | Mon, 19 May 2003 22:40:31 +0000 |
| Subject: | RE: [PHP] ifelse/else | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148145@lists.php.net to get a copy of this message | ||
Hi Dave,
If it fits your requirement, then you can try using, switch control
structure:
switch ($value)
{
case "a":
Your code..
Break;
case "b":
$value=d;
case "c":
if $value <> "c"
break;
case "d";
}
Break; will allow you to jump out of the switch control and that way other
conditions will not fire. Or if you want more than one conditions to fire,
you can change the $value in some case statement ( like it is done in case b
above), not give a break in that particular case, and let the control flow
to next case, and take the control to the case you want by using if
statements as explained in the example above.
Hope this helps.
Mohit Mittal
Software Engineer
Patni Computer Systems (P) Ltd.
Noida,
Office Tel:
91 120 2516880 - 83
Ext: 1261
Residence Tel:
91 11 26890175
-----Original Message-----
From: Dave Watson [mailto:dave_watsonau@yahoo.co.uk]
Sent: Monday, May 19, 2003 3:00 AM
To: php-general@lists.php.net
Subject: [PHP] ifelse/else
Folks,
I need some advice where I have to test the existence of a value up to five
times. there is a limit to the number of times you can use 'else' or
'ifelse'. I need the code to check a match to a certain value, if not jump
to next if statement. if it matches, it needs to exit the next if statements
totally.
Could you give me a rough idea on the structure please.
Regards, Dave.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php