且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP-和/或关键字

更新时间:2023-02-19 10:56:26

andor的优先级比&&|| .更确切地说,&&||的优先级高于赋值运算符(=),而andor的优先级更低.

and and or have higher lower precedence than && and ||. To be more exact && and || have higher precedence than assignment operator ( = ) while and and or have lower.

http://www.php.net/manual/zh/language.operators.precedence.php

通常它没有什么区别,但是在某些情况下,不知道这种区别会导致某些意外行为.在此处查看示例:

Usually it doesn't make a difference, but there are cases when not knowing about this difference can cause some unexpected behaviour. See examples here:

http://php.net/manual/en/language.operators. logical.php