dump(true and false) as boolean(true)?
This question already has an answer here:
and has a lower operator precedence than = so what you are executing is:
($x = true) and false;
So the complete expression - which you don't use the result of - will return false , but $x will be true .
It is because the and operator does not work as you think: 'AND' vs '&&' as operator
Basically, = has higher precedence.
$x = false && true;
var_dump($x);
returns bool(false) .
As does
$x = (false and true);
链接地址: http://www.djcxy.com/p/57616.html
下一篇: 转储(真和假)为布尔(真)?
