‘和’VS‘&’作为运算符我有一个开发人员决定使用的代码库AND和OR而不是&&和||.我知道运算符的优先级是不同的(&&前去and),但是对于给定的框架(PrestaShop确切地说,这显然不是一个理由。你用的是哪种版本?是and比&&?还是没有区别?
3 回答
慕桂英3389331
TA贡献2036条经验 获得超8个赞
AND
OR
$this_one = true;$that = false;$truthiness = $this_one and $that;
$truthiness
false
$truthiness
true
=
and
($truthiness = $this_one) and $that
&&
and
false
.
=
:
$truthiness = ($this_one and $that)
阿晨1998
TA贡献2037条经验 获得超6个赞
// "||" has a greater precedence than "or"// The result of the expression (false || true) is assigned to $e// Acts like: ($e = (false || true))$e = false || true;// The constant false is assigned to $f and then true is ignored // Acts like: (($f = false) or true)$f = false or true;
慕容708150
TA贡献1831条经验 获得超4个赞
if( ((i==0) && (b==2)) || ((c==3) && !(f==5)) )
- 3 回答
- 0 关注
- 505 浏览
添加回答
举报
0/150
提交
取消