Can somebody explain how null is mapped in these statements?
null>0; //=> bool(false)
null<0; //=> bool(false)
null==0; //=> bool(true)
but
null<-1; // => bool(true)开发者_如何学编程
I assume it's some mapping problem, but can't crack it.
Tried with PHP 5.3.5-1 with Suhosin-Patch.
I would point you to a few pages: http://php.net/manual/en/types.comparisons.php http://php.net/manual/en/language.operators.comparison.php http://php.net/manual/en/language.types.boolean.php
So in your final example:
null<-1 => bool(true)
The null is cast to false and the -1 is cast to true, false is less than true
In your first two examples null is cast to false and 0 is cast to false, false is not less than or greater than false but is equal to it.
Ohh the fun of null ! :D
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论