Consistency is a consistent goal for the ZF.
I agree with Peter, Willie, and Shahar.
What should we do when testing objects that have a logical null state?
Cheers,
Gavin
Peter Hodge wrote:
Sometimes it's a more consistent to use is_null() when you are using the other
type-checking functions in the same place. For example:
if(is_int($value) || is_float($value) || is_null($value))
regards,
Peter
Willie Alberty wrote:
On Oct 23, 2006, at 3:19 PM, Nico Edtinger wrote:
I guess optimizers change is_null() to === null.
If this function call is really that expensive, I'm surprised that it
isn't an optimization built-in to PHP's own parser...
I actually prefer the function version because it is clearer. Null is
not a value; it is the absence of a value. Doing an equality
comparison on something that doesn't exist doesn't make any sense. Try
the same thing in SQL:
SELECT NULL = NULL;
The result is not 1 (true), it is NULL.
SELECT NULL IS NULL;
1