Re: not_null function
| From: | Lazare Inepologlou | Date: | Thu, 03 Jul 2014 11:10:40 +0000 |
| Subject: | Re: not_null function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75214@lists.php.net to get a copy of this message | ||
2014-07-03 11:40 GMT+02:00 Xen <xen@dds.nl>:
> Heya,
>
> I was just wondering about something.
>
> It seems way more natural and flowing to have and use a "not_null"
> function in addition to some "is_null" that currently exists.
>
> The reason is that most of the time you are not checking null condition,
> you are really checking the non-null condition.
>
>
Well, there is a better alternative:
if ( $x === null ) ....
if ( $x !== null ) ....
This syntax has also the advantage that it is marginally faster as there is
neither a function call nor a negation involved.
:)
Lazare INEPOLOGLOU
Ingénieur Logiciel