Re: PHP 7.1 - Address PHPSadness #28?
| From: | Rowan Collins | Date: | Sun, 20 Sep 2015 14:05:52 +0000 |
| Subject: | Re: PHP 7.1 - Address PHPSadness #28? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88384@lists.php.net to get a copy of this message | ||
On 20 September 2015 00:29:48 BST, Lester Caine <lester@lsces.co.uk> wrote:
>> The notices emitted by is_null are COMPLETELY IRRELEVANT.
>
>? is_null returns true if the variable exists and is NULL and throws a
>notice if the variable is not set WHY is that fact COMPLETELY
>IRRELEVANT?
is_null returns true in all the same situations as isset does. There is absolutely no difference
except for whether it raises a notice.
> we have to put up with the notices because there is no CLEAN
>way to establish that a variable exists only that it is set.
You absolutely never have to put up with those notices, because if you use !isset instead of
is_null, they go away, and the program continues to work in exactly the same way.
I understand that you would like a function to detect the (non-)existence of a variable, and are
disappointed that isset is not that function, but that's a completely separate problem from how
to avoid the notices.
Again, it is not the noise which is stopping your car from flying.
Regards,
--
Rowan Collins
[IMSoP]