HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
PHP Keywords : Return true if at least one of the statements is true
The or
keyword is a logical operator.
Logical operators are used to combine conditional statements.
The return value will be true
if any one of the statements returns true
, otherwise it will
return false
.
The difference between or
and ||
is that or has very low precedence, meaning that most
other operations get evaluated first.
Read more about operators in our PHP Operators Tutorial.
Difference between or
and ||
. or
has lower precedence than the =
operator,
so the assignment happens first.
<?php
$result1 = false || true;
echo "false || true = ";
echo
$result1 ? "true" : "false";
echo "<br>";
$result2 = false or
true;
echo "false or true = ";
echo $result2 ? "true" : "false";
?>
❮ PHP Keywords