热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

PHP中奇怪的数字-PHP源码

ec(2); 由一条别人adodb的bug引发的思考 echo09,">(09)<br>";echo9,">(9)<br>"; 你可以试一下.输出结果是: 0>(09)9>(9) 而不是&nbs

由一条别人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 :)


推荐阅读
author-avatar
倩女碧海蓝天_979
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有