Craig Francis wrote on 26/08/2015 14:53:
On 26 Aug 2015, at 12:36, Rowan Collins <rowan.coll...@gmail.com> wrote:

Fortunately, the function you are looking for already exists: 
http://php.net/array_key_exists
It does, although I seem to have edited that out of my reply... was trying to 
keep it short ;-)

You could have kept the reply even shorter by omitting examples for which the language already provides the solution ;)


At the moment I'm out of examples (bit busy at the moment), but I do know that 
when I'm doing an isset() check, I'm really wanting to know if the variable (or 
key) exists

Stop. As soon as you say "or key" you completely defeat your argument. The whole thing is ONLY worth discussing if you can come up with an example of an actual variable having unknown existence.


where NULL may be a perfectly valid value.

It's not that NULL isn't a valid value; it's that "doesn't exist" isn't a meaningful state for a variable. It's like checking if the current line number is greater than 100, it shouldn't mean anything to the compiled program. See the SO answer I linked earlier for more thought experiments along these lines.

Regards,
--
Rowan Collins
[IMSoP]

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

Reply via email to