PHP 在字符串上使用 == 的假阴性

PHP false negative with == on strings

使用 == 比较 PHP 中的两个字符串时有很多误报的例子。

例如,'1' == '1.0'为真。

但是,是否存在假阴性?是否有一些字符串 $a 使得 $a == $a 由于类型杂耍而 false

不,php 不会提供漏报。 php 将通过类型杂耍 作为一项功能(它试图提供帮助)来创建误报。

相关问题:

php string comparison unexpected type juggling

Type casting and Comparison with Loose Operator "=="