Re: $GLOBALS example script on php.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unsetting doesn't leave user defined variables. Unsetting simply destroys
variables (or removes elements from an array, etc). There is nothing magic
or hidden in that script. I think the note meant exactly what it said: after
creating a local copy of the $GLOBALS array and removing super globals from
it, all that's left in it are user defined variables. And that's exactly
what gets returned from the function.

On Sun, Mar 6, 2011 at 5:11 PM, Ashim Kapoor <ashimkapoor@xxxxxxxxx> wrote:

> It doesn't though, it creates a copy of the $_GLOBALS super global array,
> removes entries that will have been set by the system (i.e. it leaves
> user-defined variables) and then returns the ones that are left, so in
> that,
> the user note is perfectly correct.
>
> What has me puzzled is how unsetting LEAVES user defined variables ? Why
> would that happen ?
>
> The array in the function lists the common server-defined variables
> > (HTTP_VARS, etc), which it unsets from the local copy of the super global
> > array ($globals). Basically, it loops through the un-named array, and
> unsets
> > that index from $globals.
> >
>
> Thank you,
> Ashim
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux