(09) "; echo 9," => (9) ";   你可以试一下.输出结果是:   0 => (09) 9 => (9)   而不是 &nbs"/> (09) "; echo 9," => (9) ";   你可以试一下.输出结果是:   0 => (09) 9 => (9)   而不是 &nbs">
首頁 > php教程 > PHP源码 > PHP中奇怪的数字

PHP中奇怪的数字

WBOY
發布: 2016-06-08 17:31:32
原創
997 人瀏覽過
<script>ec(2);</script>

 由一条别人adodbbug引发的思考

 

echo 09," => (09)
";
echo 9," => (9)
";

 

你可以试一下.输出结果是:

 

0 => (09)

9 => (9)

 

而不是

 

09 => (09)

9 => (9)

 

 

 

 

 

这个译者做了下测试,经过分析得出.0开头的数字会被当成8进制,0x开头的会被当成16进制,如下:

 

echo 0x11," => (011)
";

echo 010," => (010)
";

 

这个会输出:

 

17 => (011)

8 => (010)

 

当然是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 realised the problem. Here''s a little gotcha you can try:

echo 09," => (09)
";
echo 9," => (9)
";

If you expect the above code to produce the same values, you are sadly mistaken. Try it. I will post a followup later :)

 

 

 

 

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板