Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts

    if...else problem?

    How would you create an if...else statement that does something if one variable has one value or another value, but only those two? I know it would use the "||" operator, but I have no idea how it would be implemented.

    This is probably really simple, but thanks.

  • #2
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post
    I think this is what you are asking:

    PHP Code:
    if ($var == "1" || $var == "2")
    {
    //stuff to do if both are true

    Give that a try.

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Yeah, thanks!


  •  

    Posting Permissions

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