Just for the kicks, I ran a small benchmark:

10,000,000 calls to is_null -> 3.93504405022
10,000,000 calls === null   -> 2.06881403923

So theoretically, is_null is almost twice as slow as doing '==='.
Then again, in the real world:

100 calls to is_null -> 5.19752502441E-05
100 calls === null   -> 2.09808349609E-05

(how many scripts you know that call is_null a hundred time) the
difference is in the microseconds range... I would call that negligible.

While using === instead of is_null() is considered a good coding
standard, and should be done as much as possible, I think that Peter is
right, and it's not a bad idea to give up this practice for the sake of
readability from time to time.

My .02 Agorot ;)

Shahar.


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
> 
> 
> 
>               
> ____________________________________________________ 
> On Yahoo!7 
> Break a world record with Total Girl's World’s Largest Slumber Party 
> http://www.totalgirl.com.au/slumberparty
> 
> 

Reply via email to