PHP中&&与运算符的区别
这个问题在这里已经有了答案:
“&&”的优先级高于“和”
// The result of the expression (true && false) is assigned to $g
// Acts like: ($g = (true && false))
$g = true && false;
// The constant true is assigned to $h and then false is ignored
// Acts like: (($h = true) and false)
$h = true and false;
var_dump($g, $h);
打印虚假,真实
除了优先权以外,它们是相同的
&&
> =
> and
优先表中,所以你的第一个例子等同于: ($test = true) and false;