Wade Preston Shearer wrote:
if($var != 'a' || 'b')
It is valid syntax, but this condition will *always* be true, even if
$var neither equals 'a' nor 'b'. The reason: the expression 'b' is
considered true by PHP. You most definitely do not want to do this.
if($var != 'a' && $var != 'b')
This is what you really wanted, and it's not the same as the first bit
of code. This condition is true if $var is neither 'a' nor 'b'.
I've often wished for syntax in C-style languages where you could do
what you wanted in the first bit of code, but it'll never happen (in
C-style languages anyway), because it'd be ambiguous to the
compiler/interpreter.
--Dave
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net