note 116684 deleted from function.is-null by salathe

From: Date: Thu, 19 Feb 2015 16:36:51 +0000
Subject: note 116684 deleted from function.is-null by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201750@lists.php.net to get a copy of this message
Note Submitter: INTPnerd ---- This function is beyond useless, it is actually harmful. It discourages people from learning to distinguish between === and == since you would obviously just use === null instead of this function if you knew about that language feature. Using === null prevents you from having to remember yet another function that just does one specific thing, whereas === is useful for many different situations. This function prevents us from being able to define our own is_null($var) function which would clearly only be useful if it did something other than return $var === null; for the reasons mentioned above. Many people are reporting that this function is slower than $var === null. Some people say the speed difference is negligible, but even if that were true, in a list of pros and cons anything that is even the slightest bit of a con goes in the cons category, just as anything that is even the slightest bit of a pro goes in the pros category. When someone points out speed being a con, this is not the same as saying you should always choose the fastest code no matter what. For the reasons mentioned above I think nobody should be using the is_null() function and it should eventually become deprecated and eventually removed altogether.

« previous php.notes (#201750) next »