# Php hexadecimal and bitwise computation _ PHP Tutorial

Source: Internet
Author: User
Php hexadecimal and bitwise operations. Php hexadecimal and bitwise operations: octal. the preceding value 0 represents the octal echo0123 and br. the decimal value 83 represents three digits from right to left, with 1 Top 1 and 1 top 8 respectively, take 1 top 64echo027, br; 23 hexadecimal and bitwise operations in php
`// Octal ratio. the preceding value 0 indicates the octal echo 0123 ,''; // Three places from right to left in decimal 83, which are respectively 1 top 1, 1 top 8, 1 top 64 echo 027 ,''; // 23 // hexadecimal notation, with 0x in front representing hexadecimal notation, 0 1 2 3 4 5 6 7 8 9 a B c d e f echo 0x123,''; // In hexadecimal notation, the three digits from right to left are respectively 1 to 1, 1 to 16, and 1 to 256 echo 0x27 .""; Echo 0x1c .""; // 28 // Binary. php currently does not support direct representation, from right to left, with 1 top 1, 2 top, 4 top, and 8 top ..... /* 10 in hexadecimal 2 in hexadecimal 5 0000 0101255 1111 1111 * // bitwise operator, & bitwise and operator, | bitwise OR operator echo 5 & 12 ,''; // 6 echo 5 | 12 ,''; // 13 echo 5 ^ 12 ,''; // Exclusive or 9 echo ~ 5 ,''; // Returns the inverse. // shifts the value of one bit to the left of the bitwise operation to double the integer. the bitwise operation shifts one bit to the right, reduce the integer by 2 times \$ a = 3; echo \$ a <1 ,''; // 6 echo \$ a <2 ,''; // 12 // assign the permission value --> (delete: 8) (upload: 4) (write: 2) (read-only: 1) define ("mDELETE ", 8); define ("mUPLOAD", 4); define ("mWRITE", 2); define ("mREAD", 1 ); // the permission of the department manager is echo mDELETE | mUPLOAD | mWRITE | mREAD // equivalent to the preceding permission values: 8 + 4 + 2 + 1 = 15 // If I only have the upload and read permissions, echo mUPLOAD | mREAD`

Http://www.bkjia.com/PHPjc/1061304.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1061304.htmlTechArticlephp hexadecimal and bitwise operations // octal, the first plus 0 represents the octal echo 0123, br/; // decimal 83 from the right to the left three places, respectively is 1 top 1, enter 1 top 8, 1 top 64 echo 027, br/; // 23 // 16...

Related Keywords:

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.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.