PHP if statement: use "OR" or

Possible Duplicate:
PHP - and / or keywords

if($foo == 0 or $bar == 1 || $baz == 2)
{
    ...
}

Is it better to use "or" or || and is there any significant difference between them?


It's basically a matter of choice.

There is a difference however, when it comes to operand precedence:

if ( false && false || true ) // true

if ( false AND false || true ) // false

See it here in action: http://codepad.viper-7.com/zvFPzR

链接地址: http://www.djcxy.com/p/57634.html

上一篇: ,AND和&&

下一篇: PHP if语句:使用“OR”或