Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
来自 PHP 文档:
运算符优先级和关联性仅确定表达式的分组方式,它们不指定评估顺序。
这意味着此代码可能会出错?:
$a = true || new bla(); // bla class doesn't exist
不。
评估顺序是正常的从左到右。不是优先级/关联性。
它只是分组为:
(true) || (new bla())
该语句没有执行,因为第一个语句为真(短路);这由逻辑或运算符指定(在运行时)