On 18/09/15 12:15, Rowan Collins wrote:
>> But the whole problem here is that isset does NOT identify that the
>> result set has fields that are NULL.
> 
> My point was that if you use isset() in place of is_null(), you don't
> have to switch off any errors. That's the only difference between the
> two functions - that isset() doesn't raise a notice if the variable
> doesn't exist.

BUT YOU ARE MISSING THE POINT ...

Forget enum and more than three values in a variable ...

For SQL data coming from any decent database each variable can either
have a value in, ( which may be an empty string ) or be NULL. The NUMBER
of fields returned does not matter, a query returning a single record
can have a variable so the third condition is that rather than a field
being NULL, it does not exist, so testing for isset() only works for a
field that 'is set' and empty() only works with an empty value. Checking
for the field being present but NULL needs is_null() but THAT throws a
notice for those fields which have not been returned in this particular
result set. And one scenario here is that the database scheme actually
needs updating - but that should be handled differently - however a
system may have picked up an old copy of the data by mistake and the
missing fields need handling cleanly.

We are not talking about the number of states stored IN a variable, but
just what a variables own states are. Adding another variable to
enumerate what say 'a date relates to' is a different matter. The date
value can be a valid date ( and genealogical date goes back before most
'empty' date values ) or NULL indicating no date set OR the variable can
be missing from the result set. If you add in 'empty' one might say we
have for distinct states?

-- 
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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to