gpt4 book ai didi

PHP 5 到 7 的迁移——数字比较

转载 作者:IT王子 更新时间:2023-10-29 00:12:13 24 4
gpt4 key购买 nike

我注意到下面的代码会在 PHP 5.x 和 7 中产生不同的消息:

if ('0xFF' == 255) {
echo 'Equal';
} else {
echo 'Not equal';
}
  • 5.x:相等
  • 7:不等于

试图在迁移指南和 PHP 文档中找到导致它的更改的描述,但找不到任何内容。可能它就在那里,而我只是错过了它。你能指点一下吗?谢谢!

我看的地方

最佳答案

它在这里:http://php.net/manual/en/migration70.incompatible.php

Changes to String Handling

Hexadecimal strings are no longer considered numeric

Strings containing hexadecimal numbers are no longer considered to be numeric. For example: <?php var_dump("0x123" == "291"); etc...

关于PHP 5 到 7 的迁移——数字比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39709921/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com