The odd number in PHP-Translated by Ma yongzhan

Source: Internet
Author: User

Copyright statement: original works can be reproduced. During reprinting, you must mark the original publication, author information, and this statement in hyperlink form. Otherwise, legal liability will be held. Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan

Original address: http://phplens.com/phpeverywhere? Q = node/View/249
Thoughts Caused by a bug in others' ADODB
 
Echo 09, "=> (09) <br> ";
Echo 9, "=> (9) <br> ";
 
You can try it. The output result is:
 
0 => (09)

9 => (9)
 
Instead
 
09 => (09)

9 => (9)
 
 
 
 
 
The translator made a test. After analysis, the numbers starting with. 0 will be treated as octal, and those starting with 0x will be treated as hexadecimal, as follows:
 
Echo 0x11, "=> (011) <br> ";

Echo 010, "=> (010) <br> ";
 
This will output:
 
17 => (011)

8 => (010)
 
Of course 10x16 + 1 = 17
 
1x8 + 0 = 8
 
OK.
 
 
 
 
 
 
 
 
 
Someone reported a bug in ADODB, the open source dB library I maintain. I went crazy for half an hour until I realized the problem. Here's a little gotcha you can try:
Echo 09, "=> (09) <br> ";
Echo 9, "=> (9) <br> ";
If you want CT the above Code to produce the same values, you are sadly mistaken. Try it. I will post a followup later
 

Contact Us

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.