Results 1 to 4 of 4

Thread: If Statements

  1. #1

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    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 56 38) {

    //Do stuff

    } else {

    if (
    $f == 34 53 9) {

    //do other stuff 

    } else {

    if (
    $f == 10 8) {

    //do more crap

    } else {

    //other things

              
    }  
          }
       }


  2. #2
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    PHP Code:
    if ($f == 43 56 38) {

    //Do stuff


    elseif (
    $f == 34 53 9) {

    //do other stuff 

    }
    elseif (
    $f == 10 8) {

    //do more crap

    }
    else {

    //other things



  3. #3
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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.

  4. #4
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    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
    Wayne

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width