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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    69
    Thanks
    8
    Thanked 0 Times in 0 Posts

    IF Else Statement Problem

    Is there a way to do the following??


    IF statement1 OR statement2 OR statement3 is true

    then do code here



    Seems like there should be but i haven't had any luck so far...

  2. #2
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,758
    Thanks
    83
    Thanked 110 Times in 109 Posts
    PHP Code:
    if (($text == '1') && $text2 == '2' && $text3 == '3') {
    //Do
    }
    else {
    //Don't do


  3. #3
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    PHP Code:
    if($statment1 || $statement2 || $statement3) echo 'some of the statements is true'

  4. Users who have thanked poyzn for this post:

    KatieK (12-09-2010)

  5. #4
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,758
    Thanks
    83
    Thanked 110 Times in 109 Posts
    Whoops haha missed the OR in the original message, I did AND


 

Posting Permissions

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