On 18/09/15 20:37, Benoit Schildknecht wrote: > You have a lot of people who use isset() against null elements in an > array. null elements happen a lot when interacting with an SQL server > (for instance). I personally use array_key_exists(), but most people > won't do the same at all. Because they think it is the same. And they'll > forget, because isset() behaviour doesn't make sense, since null doesn't > exactly behave as you say.
The 'bug' is that isset() only returns true if there is a value in the variable. If the variable is 'NULL' it returns false ... which it also does if the variable does not exist. So we have 'false', but if we call is_null and the variable does not actually exist then we get a notice about undeclared variable. The fact that a result set may well exclude some variables is a practical proposition, but PHP does not cater for it ... and some people think that this should be treated as bad coding while others of us expect this action. -- 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