discostudio wrote:Why wouldn't the
if($X == 1 || 2 || 3)
option work.
I have used it on many occasions and have never found a bug.
I'm sorry to say that you have not tested your code very well and you have bugs in your code. Go back and fix them.
The "|| 2" and "|| 3" parts in the example "if" statement provided by you will always evaluate to TRUE. Meaning the code within the "if" statement will always get executed regardless of the value of the $X variable.
If you had this for example:
if ($X == 1 || 0) {
}
The zero evaluates to FALSE, so in this case the code within the "if" statement will only be executed when the $X variable is equal to one. Not even if $X contained a zero value.
Run some of these test code to see for yourself.
🙂