You are probably looking for something like `array_key_exists($varName,
get_defined_vars());`: https://3v4l.org/XagEA

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 26 August 2015 at 04:26, Sherif Ramadan <theanomaly...@gmail.com> wrote:

> I get that it exists. I'm asking what is the usefulness of having a
> function that tells you the variable is null? In theory this sounds great
> and is actually very doable by checking the symbol table for the hash.
> However, in practice, who actually has a use for this? Null is a special
> value in PHP, so if you're assigning it to a variable explicitly you should
> already know you've initialized that variable and can safely rely on if ($x
> === null) in your code.
>
> I'm not confused about the differences. I'm questioning the usefulness of
> such a function.
>
> On Tue, Aug 25, 2015 at 11:18 PM, Scott Arciszewski <sc...@paragonie.com>
> wrote:
>
> > Because $x exists.
> >
> > https://3v4l.org/kUJtP
> > Scott Arciszewski
> > Chief Development Officer
> > Paragon Initiative Enterprises
> >
> >
> > On Tue, Aug 25, 2015 at 11:16 PM, Sherif Ramadan
> > <theanomaly...@gmail.com> wrote:
> > > Yes, because all undefined variables in PHP are implicitly null. As far
> > as
> > > PHP is concerned, if it's null, it's by definition _not defined_. Also,
> > > still not seeing where a NOTICE is involved here? Those functions never
> > give
> > > errors.
> > >
> > > What is the usefulness of a function that merely returns true when a
> > > variable is null?
> > >
> > > On Tue, Aug 25, 2015 at 11:13 PM, Scott Arciszewski <
> sc...@paragonie.com
> > >
> > > wrote:
> > >>
> > >> On Tue, Aug 25, 2015 at 11:11 PM, Sherif Ramadan
> > >> <theanomaly...@gmail.com> wrote:
> > >> > That's exactly what isset() does. isset/empty never raise errors.
> > >> >
> > >> > On Tue, Aug 25, 2015 at 11:09 PM, Scott Arciszewski
> > >> > <sc...@paragonie.com>
> > >> > wrote:
> > >> >>
> > >> >> Hi everybody,
> > >> >>
> > >> >> Would anyone be interested in adding another helper like
> > >> >> isset()/empty() simply called exists() which would return true if
> the
> > >> >> variable is defined in the current scope (i.e. without raising an
> > >> >> E_NOTICE)?
> > >> >>
> > >> >> It should be a simple change to add this function but it's too late
> > >> >> for 7.0 so, if there is any interest, I would respectfully put it
> off
> > >> >> until 7.1.
> > >> >>
> > >> >> Scott Arciszewski
> > >> >> Chief Development Officer
> > >> >> Paragon Initiative Enterprises <https://paragonie.com>
> > >> >>
> > >> >> --
> > >> >> PHP Internals - PHP Runtime Development Mailing List
> > >> >> To unsubscribe, visit: http://www.php.net/unsub.php
> > >> >>
> > >> >
> > >> http://phpsadness.com/sad/28
> > >> https://3v4l.org/2vrKG
> > >>
> > >> Not quite.
> > >>
> > >> Scott Arciszewski
> > >> Chief Development Officer
> > >> Paragon Initiative Enterprises <https://paragonie.com>
> > >
> > >
> >
>

Reply via email to