note 116684 added to function.is-null

From: Date: Wed, 11 Feb 2015 04:42:09 +0000
Subject: note 116684 added to function.is-null
Groups: php.notes 
Request: Send a blank email to php-notes+get-201695@lists.php.net to get a copy of this message
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. ---- Server IP: 72.52.91.14 Probable Submitter: 98.202.88.8 ---- Manual Page -- http://php.net/manual/en/function.is-null.php Edit -- https://master.php.net/note/edit/116684 Del: integrated -- https://master.php.net/note/delete/116684/integrated Del: useless -- https://master.php.net/note/delete/116684/useless Del: bad code -- https://master.php.net/note/delete/116684/bad+code Del: spam -- https://master.php.net/note/delete/116684/spam Del: non-english -- https://master.php.net/note/delete/116684/non-english Del: in docs -- https://master.php.net/note/delete/116684/in+docs Del: other reasons-- https://master.php.net/note/delete/116684 Reject -- https://master.php.net/note/reject/116684 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201695) next »