Anonymous user
Bitwise operations: Difference between revisions
Moved PHP shift code over
(Added shifts to the task, added examples from Bit shifts, removed outputs from ones with shift added, many incorrect examples now exist) |
(Moved PHP shift code over) |
||
Line 264:
print "after use integer:\n";
print 'a << b: ', $a << $b, "\n"; # left shift
print 'a >> b: ', $a >> $b, "\n"; # arithmetic right shift
}</perl>
=={{header|PHP}}==
{{incorrect|PHP}}
<php>$x = -3;
$n = 1;
echo '$x << $n: ', $x << $n, "\n"; // left shift
echo '$x >> $n: ', $x >> $n, "\n"; // arithmetic right shift</php>
=={{header|Python}}==
<python>def bitwise(a, b):
|