|
-
Sep 16th, 2002, 06:01 PM
#1
Thread Starter
Fanatic Member
If Statements
Is there a better way to do something like this and is this the correct way to do if statements and the correct way to do Or
PHP Code:
if ($f == 43 | 2 | 56 | 38) {
//Do stuff
} else {
if ($f == 34 | 53 | 4 | 9) {
//do other stuff
} else {
if ($f == 3 | 10 | 8) {
//do more crap
} else {
//other things
}
}
}
}
-
Sep 16th, 2002, 08:24 PM
#2
Fanatic Member
PHP Code:
if ($f == 43 | 2 | 56 | 38) {
//Do stuff
}
elseif ($f == 34 | 53 | 4 | 9) {
//do other stuff
}
elseif ($f == 3 | 10 | 8) {
//do more crap
}
else {
//other things
}
-
Sep 17th, 2002, 12:01 AM
#3
Frenzied Member
I'll be very surprised that works.
if ($f == 43 | 2 | 56 | 38
if f=43 or 2
or 2 what???
you have to use f=43 or f=2 or f=56
but personally I sould use a switch statement.
-
Sep 19th, 2002, 08:28 AM
#4
Frenzied Member
Originally posted by phpman
but personally I sould use a switch statement.
Just thinking that there 
switch($f){
case "1":
Function();
break;
case "2":
Function();
break;
case"3":
Function();
break;
default:
Function();
break;
}
Just make sure u add stuff below the switch when u want it below the stuff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|