Php base bit operation php bit operation $ a & amp; $ band (bitwise AND) $ a | $ bor (bitwise OR) $ a ^ $ bXor (by bit or )~ $ ANot (not by bit) $ a & lt; $ bShiftleft (left shift) $ a & gt; $ bShiftright (right shift) $ a & amp; $ B sets the bitwise of 1 in both $ a and $ B to 1. for example, bit operations based on php.
Php bitwise operations $ a & $ B and (bitwise and) $ a | $ B or (bitwise or) $ a ^ $ B Xor (bitwise Xor or )~ $ A Not (Not by bit) $ a <$ B Shift left (left Shift) $ a >$ B Shift right (right Shift) for details, set the bitwise of $ a & $ B to 1 and set the bitwise of $ a and $ B to 1. for example: 10 & 12 = 810 101012 11001000 8 $ a | $ B by bit or set one of $ a or $ B as 1. for example: 10 | 12 = 1410 101012 11001110 14 $ a ^ $ B by bit or for example: 10 ^ 1210 101012 11000110 6 ~ A sets the value of 0 in $ a as 1, 1, and 0 by bit. for example :~ 10 = 10 1010-11 $ a <$ B move left to move $ B from $ a to the left (each movement represents multiplied by 2). For example: 1 <10 = 10241 (1) shifts 10 digits left. 10000000000 (1024) is equivalent to the 10 power of 1*2. it is really depressing that php does not have a power operation. $ A >> B B shifts the right of $ a to the right of $ B (each movement is divided by 2). For example, 1024 <2 = 125610000000000 (1024) the 2-digit right shift is 100000000 (256). php calculates $ a & $ B and (bitwise and) $ a | $ B or (bitwise or) $ a ^ $ B Xor (bitwise Xor )~ $ A Not (Not by bit) $ a <$ B Shift left (left Shift) $ a >$ B Shift right (right Shift) for details, set the bitwise of $ a & $ B to 1 and set the bitwise of $ a and $ B to 1. for example: 10 & 12 = 810 101012 1100 8 $ a | $ B by bit or set one of $ a or $ B as 1. for example: 10 | 12 = 1410 101012 1100 14 $ a ^ $ B by bit or for example: 10 ^ 1110 1210 101012 1100 6 ~ A sets the value of 0 in $ a as 1, 1, and 0 by bit. for example :~ 10 = 10 1010-11 $ a <$ B move left to move $ B from $ a to the left (each movement represents multiplied by 2). For example: 1 <10 = 10241 (1) shifts 10 digits left. 10000000000 (1024) is equivalent to the 10 power of 1*2. it is really depressing that php does not have a power operation. $ A >> B B shifts the right of $ a to the right of $ B (each movement is divided by 2). For example, 1024 <2 = 125610000000000 (1024) the 2-digit right shift is 100000000 (256)