Today friends in the group asked the next bitwise and/or questions.
PHP has been working for 1 years, probably not familiar with this one. Introduce this part to the novice friend here.
By being located primarily on the binary number operation.
Bitwise and operations are mainly performed on binary numbers. The following describes the bitwise AND and/or operations in PHP, we hope to help you with bitwise and binary operations.
The code is as follows:
The code is as follows:
$ A = 1;$
Bitwise AND operations are mainly performed on binary numbers.The Code is as follows:Copy codeThe Code is as follows:$ A = 1;$ B = 2;$ C = $ a ^ B;Echo $ c // 3?> This is not a simple addition.Convert decimal 1 to binary 00000001Convert decimal 2 to
& Lt; scripttype & quot; text/javascript & quot; & gt; varnum125; varnum23; alert (num1 | num2); // output: 27; compare the two numeric values in binary format. The return value is 0 only when the numbers at the same position are 0. If the values at
[Root@legion10 ~]# Echo 5 22|awk ' {print $1,$2,and ($1,$2), or ($1,$2), XOR ($1,$2)} ' 5 4 [Root@legion10 ~]#
Analytical:
And: And operations, only true when the same is true, similar to multiplication. Or: Or an operation, which is false
Bitwise and operations are mainly performed on binary numbers. The following describes the bitwise AND and/or operations in PHP, we hope to help you with bitwise and binary operations.
The code is as follows:
The code is as follows:
$ A = 1
Read 《
Pro net 2.0 Windows Forms and custom cortrols in C #
You can see the enumeration section and find that multiple values need to be merged in one enumeration.
"|"
I didn't pay much attention to the operators. Today I thought about why
This is the permission value.2^0=1, the corresponding 2 in the number of "0001″ (here ^ I expressed as a" sub-party ", that is: 2 of 0 parties, the same below)2^1=2, the corresponding 2-in number is "0010″2^2=4, the corresponding 2-in number is "0100
Bitwise operators include: | bitwise OR or, & bitwise AND and, ^ bitwise XOR or XOR ,~ Not, right shift, and so on. This article describes the application of the bitwise operator in C. It mainly includes:
○ Hexadecimal conversion※Convert
C # basic usage of bitwise operators,
Bitwise operators include: | bitwise OR, & bitwise AND, ^ bitwise xor or xor ,~ NOT, Right Shift, and so on. This article describes the application of the bitwise operator in C. It mainly includes:
○
due to contact with the lower level of data processing to the following use of finishing (reference network)bit arithmeticThe Operation component of a bitwise operation can only be integer or character data, and the bitwise operation considers the
In this article, let's take a look at the objective-c bitwise operator . There are various operators in the objective-c language to handle the special positioning in numbers, as shown in the following table:
Symbol
Operation
Bit operationsThe operation component of the bit operation can only be integer or character data, and the bitwise operation regards the Operation object as a bit string information composed of two digits, completes the specified operation by bit,
Conversion from: c |, |, &, &, Or ,~ ,! Operation
Bitwise operation
The bitwise operation component can only be integer or numeric type data. bitwise operations regard the operation object as Bit String information consisting of binary digits to
bit arithmeticThe operation component of a bitwise operation can only be integer or character data, and the bitwise operation considers the operand as a bit string information composed of binary bits, and completes the specified operation by bit,
Unary operatorAn operator that can manipulate only one value is called a unary operator. The unary operator is the simplest operator in ECMAScript.1. Increment and decrement operatorsThe increment and decrement operators draw directly from C, and
C language bit operationA bitwise operation is a binary-based operation. In system software, it is often necessary to deal with bits problems. The C language provides 6 bit manipulation operators. These operators can only be used for integer
bit arithmeticThe operation component of a bitwise operation can only be integer or character data, and the bitwise operation considers the operand as a bit string information composed of binary bits, and completes the specified operation by bit,
Previously updated for a period of time on the swift language of the blog, the continuous update of the 6, 7-article appearance. During the period, some of the things in the iOS development of SQLite, Collectionviewcontroller and Reactivecocoa were
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.