Test IF with multiple conditions in PHP

Solved
Bilibob -  
Dead45 Posted messages 1 Status Membre -
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 réponses

Nabla's Posted messages 20731 Status Contributeur 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