PHP IF((X)||(X && Y))声明[关闭]

Can I have a number of conditions in my if statement

if( (X) || (X && Y)){
    echo "some statement";
}

And if I can, can it be written

if(empty(x) || !empty(x) && y==25)){
    echo "this is true";
}

Yes you can have as many conditions as you want, however it is recommended that you structure them with parenthesis the same way we did in college when we were doing math.

if($a==1 && $b==2)

if($a== 1 && ( $b==2 || $c==3))

if(($a==1 || $b==2) && ($c==3 || $d==4))

if((($a==1 || $b==2) && $c==3) && ($d==4 || ($e==5 && $f==^)))

You can do as many levels as you want, but put parenthesis so you will understand how the conditions work.