1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Multiple conditions in if statement

Discussion in 'PHP' started by egdcltd, Nov 9, 2006.

  1. #1
    How do I write an if statement with multiple conditions needing to be true?

    ie:

    if (condition1=a AND condition2=b AND condition3=c)
    {
    }
    else
    {
    }

    I'm sure it can be done, I just can't find instructions on how to do it.
     
    egdcltd, Nov 9, 2006 IP
  2. KC TAN

    KC TAN Well-Known Member

    Messages:
    4,794
    Likes Received:
    352
    Best Answers:
    0
    Trophy Points:
    155
    #2
    
    if ($x=='x' && $y=='y' && $z=='z'){
    // do if matches
    }else {
    //do otherwise
    }
    
    PHP:
    Hope that this is what you want :)
     
    KC TAN, Nov 9, 2006 IP
    egdcltd likes this.
  3. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, that was exactly what I was looking for. Thanks.
     
    egdcltd, Nov 10, 2006 IP