Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,847 questions

9,749 answers

573 users

How to show the different result between operation in regular and bitwise operators in PHP

1 Answer

0 votes
// Regular
echo "a: " . (true && true) . "<br />";
echo "b: " . (true && false) . "<br />";
echo "c: " . (false && false) . "<br />";
echo "d: " . (false && true) . "<br />";

echo "e: " . (true || false) . "<br />";
echo "f: " . (false || false) . "<br />";
echo "g: " . (true || true) . "<br />";
echo "h: " . (false || true) . "<br />";

echo "i: " . (true xor false) . "<br />";
echo "j: " . (false xor false) . "<br />";
echo "k: " . (true xor true) . "<br />";
echo "l: " . (false xor true) . "<br />";

echo "---------<br />";

// Bitwise
echo "a: " . (true & true) . "<br />";
echo "b: " . (true & false) . "<br />";
echo "c: " . (false & false) . "<br />";
echo "d: " . (false & true) . "<br />";

echo "e: " . (true | false) . "<br />";
echo "f: " . (false | false) . "<br />";
echo "g: " . (true | true) . "<br />";
echo "h: " . (false | true) . "<br />";

echo "i: " . (true ^ false) . "<br />";
echo "j: " . (false ^ false) . "<br />";
echo "k: " . (true ^ true) . "<br />";
echo "l: " . (false ^ true) . "<br />";
 
 
 
/*
run:
      
a: 1
b: 
c: 
d: 
e: 1
f: 
g: 1
h: 1
i: 1
j: 
k: 
l: 1
---------
a: 1
b: 0
c: 0
d: 0
e: 1
f: 0
g: 1
h: 1
i: 1
j: 0
k: 0
l: 1
  
*/

 




answered Nov 24, 2017 by avibootz
...