[英]PHP/MySQL — What does || mean?
I am trying to set up a simple php/mysql database on my website and the example has a line that says: 我试图在我的网站上建立一个简单的php / mysql数据库,该示例的一行显示:
if (!$searchtype || !?searchterm) {
What are the ||??? 什么是|| ??? I tried to copy and paste them but they cause syntax errors.
我试图复制并粘贴它们,但是它们会导致语法错误。 Noob question I know, but would love an answer nonetheless!
我知道Noob的问题,但仍然希望得到答案!
its ||(OR)
logical operator 其
||(OR)
逻辑运算符
$a ||
$ a || $b Or TRUE if either/both $a or $b is TRUE.
$ b如果$ a或$ b中的一个为TRUE,则为TRUE。
and it should be 它应该是
if (!$searchtype || !searchterm) {
as in op this Comment you can write this by 就像在op this Comment中一样,您可以这样写
I think the code actually is : 我认为代码实际上是:
if (!$searchtype || !$searchterm) {
||
means OR operator, meaning conditions is satisfied if either of the condition is true. 表示“或”运算符,表示条件满足(如果任一条件为真)。
Its an OR
logical operator for handling conditions: 它是用于处理条件的
OR
逻辑运算符:
Ex : 例如:
$a || $b
Or TRUE if either $a or $b is TRUE. 如果$ a或$ b为TRUE,则为TRUE。
See : http://php.net/manual/en/language.operators.logical.php 参见: http : //php.net/manual/zh/language.operators.logical.php
for more details 更多细节
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.