Re: not_null function
| From: | Mats Lindh | Date: | Fri, 04 Jul 2014 07:57:38 +0000 |
| Subject: | Re: not_null function | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75245@lists.php.net to get a copy of this message | ||
On Fri, Jul 4, 2014 at 9:43 AM, Kris Craig <kris.craig@gmail.com> wrote:
> What would be wrong with changing it from a function to a language
> construct like isset() and empty()? If is_null() were the equivalent of
> !isset( $var ) || $var === NULL, it would make a hell of a lot more sense
> than what's there now.
>
So your suggestion is to make it _exactly_ like isset?
Remember that language constructs are, in general, a cludge. They appear to
be functions, but you can't use them in places where you'd use a function,
such as validation callbacks. If you make is_null a language construct,
validate($foo, 'is_null') would not work as people assume.
There is no utility gained from removing or changing is_null. It
complements the other is_* functions that check for a specific type, and
having more than one way to achieve something is not always a bad idea.
Let this one rest.
--mats