Source Code:
(back to article)
<?php $a = 4; // binary equivalent is 100 $b = 5; // binary equivalent is 101 $c = $a | $b; // performs a bitwise OR operation, resulting in 101 (decimal 5) $d = $a || $b; // performs a logical OR operation, resulting in true echo "a = $a (binary " . decbin($a) . ")\n"; echo "b = $b (binary " . decbin($b) . ")\n"; echo "a | b = $c (binary " . decbin($c) . ")\n"; echo "a || b = " . ($d ? 'true' : 'false') . "\n";
Result:
Report an issue