Re: PHP 7.1 - Address PHPSadness #28?
| From: | Lester Caine | Date: | Fri, 18 Sep 2015 15:55:29 +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-88335@lists.php.net to get a copy of this message | ||
On 18/09/15 16:35, Rowan Collins wrote:
>> exists() has a place in SOME coding
>> styles which does not require to find the 'NULL' some other way to avoid
>> the potential notice!
>
> exists() would not be a way of avoiding the notice. exists() would be a
> way of distinguishing an extra state, quite separate from null.
>
> If what you want to write is "if ( ! exists($foo) || is_null($foo) ) {
> ... }" then that is exactly what "if ( isset($foo) )" will give you,
> without any notices whatsoever.
NO what I want is
if ( exists($foo) ) {
is_null($foo) { build uninitialised field }
else { build initialise with ($foo) }
}
isset($foo) only allows { build initialise with ($foo) }
and the NULL state is missed with no way of detecting it cleanly if the
$foo does in fact not exist.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk