In any case, consider using === whenever possible to reduce ambiguity.
== vs ===
Logic Expression Weirdness
It’s important to remember that logic expressions like these are not actually booleans. In an OR expression, the first not-evaluated-to-false expression is returned. IF THERE ARE NONE - IT RETURNS THE LAST ENTRY REGARDLESS. It is easy to screw yourself here.
If succeeds if the expression evaluates to any string other than “”, true, or 1.
If fails if the expression evalutes to anything other than the above.
As I run across more, I’ll keep adding them to this list.
The moral of this story is to not use ==. Please use ===.
Also, some will write if(true==condition) for readability in lieu of if(condition). If you do this in conjunction with ==, and especially if others work on the same codebase, expect to be screwed repeatedly.