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 ;-) 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, where NULL may be a perfectly valid value. So there is a slight annoyance (and typically a quick fix) to identify if the variable has just been set to NULL. On 26 Aug 2015, at 12:36, Rowan Collins <rowan.coll...@gmail.com> wrote: > Craig Francis wrote on 26/08/2015 12:23: >> >> If you want some example of where I got this wrong... >> >> I have a config array [...] >> >> When creating a URL builder that allowed the query string to be passed in as >> an array [...] >> >> Neither were major problems, just a slight annoyance (i.e. identified and >> fixed before I committed the code). But I'm normally using an isset() as the >> proposed exists() function would work. > > Both of these example involve not an undefined variable, but an undefined > array key, which is a much less controversial scenario. > > Fortunately, the function you are looking for already exists: > http://php.net/array_key_exists > > Regards, > -- > Rowan Collins > [IMSoP] > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php