3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = 10000; $b = 11111; $c = $a & $b; $r = $a ^ $b; var_dump(decbin($a), decbin($b), decbin($c), decbin($r), '---'); while ($c) { $shift = $c << 1; $c = $r & $shift; $r ^= $shift; var_dump(decbin($s), decbin($c), decbin($r), '---'); } var_dump($r);
Output for 5.0.4 - 7.2.0
string(14) "10011100010000" string(14) "10101101100111" string(14) "10001100000000" string(12) "110001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(11) "10000000000" string(15) "100101001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(12) "100000000000" string(15) "100001001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(1) "0" string(15) "101001001110111" string(3) "---" int(21111)
Output for 4.3.0 - 5.0.3
string(14) "10011100010000" string(14) "10101101100111" string(14) "10001100000000" string(12) "110001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(11) "10000000000" string(15) "100101001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(12) "100000000000" string(15) "100001001110111" string(3) "---" Notice: Undefined variable: s in /in/rhUud on line 15 string(1) "0" string(1) "0" string(15) "101001001110111" string(3) "---" int(21111)