[development] NULL testing and isset

Richard Archer drupal.org at juggernaut.com.au
Tue Jan 17 20:22:58 UTC 2006

At 12:24 PM +0100 17/1/06, Karoly Negyesi wrote:

>instead of === NULL use isset, please. Three times faster. If you are
>using !$foo for NULL testing (checking whether a static is set)

I see no difference in performance between the available methods
of checking for NULL (PHP 4.3.11 on LAMP).

I agree though that isset should be used for several reasons:

- isset does not throw an Undefined variable warning
  empty, === and ! each throw a warning.

- Always using isset improves code style and consistency.

- empty and ! trigger on 0, FALSE and "" which is
  undesirable and confusing.

- Standardising on isset makes it less likely that an
  array_key_exists will slip in.

This should be in the handbook so I have posted a comment at:


More information about the development mailing list