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 OR $a = $b;
这段代码的行为是什么?
或者
这段代码的目的是什么?
谢谢,
运算符“OR”是一个逻辑运算符,用于检查两个(或多个)项中的一个是否为真。如果 $a 或 ($a = $b) 为 TRUE。运算符“==”(在您的问题中是 =,但我认为是 ==)是一个比较运算符,用于检查 $a 是否等于 $b(如相同的值,术语 A 为真,术语 B 为真,其他情况)。谢谢