所有的二元按位运算都可以在 op= 形式的赋值语句中使用。除了 ~。
例如:
value <<= 4;
等价于:
value = value << 4;
value &= 0xFF;
等价于:
value = value & 0xFF;
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int value = 12;
value &= 2; //等价于 value = value & 2;
printf("%d",value);
return 0;
}Code language: PHP (php)