null with PHP < and > operators null with PHP < and > operators php php

null with PHP < and > operators


I would point you to a few pages: http://php.net/manual/en/types.comparisons.phphttp://php.net/manual/en/language.operators.comparison.phphttp://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