Re: PHP 7.1 - Address PHPSadness #28?

From: Date: Wed, 26 Aug 2015 13:53:51 +0000
Subject: Re: PHP 7.1 - Address PHPSadness #28?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-87932@lists.php.net to get a copy of this message
On 26 Aug 2015, at 12:36, Rowan Collins <rowan.collins@gmail.com> wrote: > Fortunately, the function you are looking for already exists: S=$�“ > ‡ñ Eò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.collins@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 >

« previous php.internals (#87932) next »