I think sometimes I don’t need to use ELSEIF and not repeat stuff by maybe doing multiple checks inline.
I’ve done this before.
I’m trying this simple line and just can’t make it work.
I read that:
OR is the same as ||
AND is the same as &&
Code (The short way, but doesn’t work):
if($subdom<>'www' or $subdom<>'nosub') {do some stuff if any of the two are meet}
I also tried this:
Code:
if((subdom!='www') || ($subdom!='nosub')){}
What will be the correct operators to check for any of the two? Is it || or &&. Should we use != or <> also?
Some Info found after question answered:
$a && $b
//And //TRUE if both $a and $b are TRUE.$a || $b
//Or //TRUE if either $a or $b is TRUE.
Either of these will work as the comparison:
!== (not equal identical), but not != as it will mean ‘does not assign’
<> will do the trick without too much merry go round.
Your expression is always true, considering your example, check the table with different input values for $subdom:
$expr = ($subdom!=’www’) || ($subdom!=’nosub’);
I think you’re wanting to use the AND (&&) operator here…