Hi! instead of === NULL use isset, please. Three times faster. If you are using !$foo for NULL testing (checking whether a static is set), then use isset, too. I have not checked how many times isset faster here but that's a language construct and it's a hell lot faster. Regards Karoly Negyesi
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: http://drupal.org/node/318#comment-84409 ...R.
participants (2)
-
Karoly Negyesi -
Richard Archer