Operator | Sign | Syntax | Additional Information |
---|---|---|---|
AND | && | (expr1) && (expr2) | TRUE if both expr1 and expr2 are TRUE |
OR | || | (expr1) || (expr2) | TRUE if either expr1 or expr2 is TRUE |
NOT | ! | !(expr1) | TRUE if expr1 is not TRUE |
<?php
$var1 = true;
$var2 = false;
$var3 = $var1 && $var2;
$var4 = $var1 || $var2;
$var5 = !$var1;
echo (int)$var3, "\r\n"; // 0 - FALSE
echo (int)$var4, "\r\n"; // 0 - TRUE
echo (int)$var5, "\r\n"; // 0 - FALSE
?>
[result]
0
1
0