Quick Question

A

Anonymous

Guest
Can someone tell me what exactly this expression is doing?

$variable= $nib6 & 127;

little confused on the "&" Is it Variable is equal to $nib6 and 127? Doesnt make sense to me...
 
Code:
$variable= $nib6 & 127;

This code is taking the value of the expression $nib6 & 127 and assigning it to $variable. The & operator is a binary AND, so the value of the expression is the binary AND of whatever's in $nib6 and 127 (binary 1111111). Since I'm guessing you're not too well versed in binary arithmetic, I won't go any further since it won't mean anything to you, and because we can't really know what the purpose of this code is without knowing its context, since binary arithmetic can be used as a shortcut in so many different operations.
 
Back
Top