Test IF with multiple conditions in PHP

Solved
Bilibob -  
Dead45 Posted messages 1 Status Member -
Hello,

I would like to know how to structure an IF test with multiple conditions in PHP.

Thanks in advance...
Configuration: Windows XP Firefox 3.5.3

5 answers

  1. Nabla's Posted messages 18201 Registration date   Status Contributor Last intervention   3 228
     
    You separate each condition with && , like in C!
    if ($a>1 && $a<5) echo "$a is between 1 and 5"


    && means AND
    || means OR

    if ($gender=="M" || $gender=="F") echo "you are a man or a woman"; else echo "you are neither a man nor a woman... maybe a Brazilian trans person?"
    21