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