使用PHP <和>运算符返回null

Szy*_*zyk 24 php mapping comparison null operators

有人可以解释在这些语句中如何映射null吗?

null>0; //=> bool(false)
null<0; //=> bool(false)
null==0; //=> bool(true)
Run Code Online (Sandbox Code Playgroud)

null<-1; // => bool(true)
Run Code Online (Sandbox Code Playgroud)

我认为这是一些映射问题,但不能破解它.

尝试使用带有Suhosin-Patch的PHP 5.3.5-1.

Tne*_*nem 29

我想指出几页: http://php.net/manual/en/types.comparisons.php http://php.net/manual/en/language.operators.comparison.php http:// php达网络/手动/ EN/language.types.boolean.php

在你的最后一个例子中:

null<-1 => bool(true)
Run Code Online (Sandbox Code Playgroud)

null被强制转换false-1强制转换true,false小于true

在你的前两个例子中null被强制转换为,false并且0被转换为false,false不小于或大于false但等于它.

哦,有趣的null!:d