Bitwise operations: Difference between revisions

Content added Content deleted
Line 336: Line 336:
}</perl>
}</perl>
=={{header|PHP}}==
=={{header|PHP}}==
<php>function bitwise($a, $b)
{{incorrect|PHP}}
{
<php>echo '$a << $b: ', $a << $b, "\n"; // left shift
echo '$a >> $b: ', $a >> $b, "\n"; // arithmetic right shift</php>
echo '$a AND $b: ', $a & $b, "\n";
echo '$a OR $b: ', $a | $b, "\n";
echo '$a XOR $b: ', $a ^ $b, "\n";
echo 'NOT $a: ', ~$a, "\n";
echo '$a << $b: ', $a << $b, "\n"; // left shift
echo '$a >> $b: ', $a >> $b, "\n"; // arithmetic right shift
}</php>


=={{header|Pop11}}==
=={{header|Pop11}}==