Re: [PHP] $GLOBALS example script on php.net

2011-03-07 Thread FeIn
I am unable to provide a better definition that user defined variables. User defined variables are variables that are declared by the user. User here means the creator (or maintainer of the script). So for: ?php $a = 'A'; $b = 'B'; $c = 'C'; function globals() { $globals = $GLOBALS;

Re: [PHP] $GLOBALS example script on php.net

2011-03-07 Thread Ashim Kapoor
?php $globalvar1=1; $globalvar2=2; function globals() { $globals = $GLOBALS; var_dump($GLOBALS); print_r(br /Before...); print_r($globals); foreach (array( 'GLOBALS', '_ENV', 'HTTP_ENV_VARS', '_POST', 'HTTP_POST_VARS', '_GET',

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
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

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread FeIn
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

Re: [PHP] $GLOBALS example script on php.net

2011-03-06 Thread Ashim Kapoor
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

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Richard Quadling
On 5 March 2011 05:44, Ashim Kapoor ashimkap...@gmail.com wrote: Dear all, I was reading this page http://php.net/manual/en/reserved.variables.globals.php and  I found the following script there : Here's a function which returns an array of all user defined global variables: ?php

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
I'll remove it. How does one remove user notes from php.net ? Thank you, Ashim

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread David Hutto
On Sat, Mar 5, 2011 at 5:10 AM, Ashim Kapoor ashimkap...@gmail.com wrote: I'll remove it.  How does one remove user notes from  php.net ? I'd guest they had been granted access to the php.net page editor, but I may be wrong. Not that that site hasn't been scraped by other sites and added to

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Daniel Brown
On Sat, Mar 5, 2011 at 05:42, David Hutto smokefl...@gmail.com wrote: I'd guest they had been granted access to the php.net page editor, but I may be wrong. Not that that site hasn't been scraped by other sites and added to their content, or been catalogued by google cache or alexis, etc.

Re: [PHP] $GLOBALS example script on php.net

2011-03-05 Thread Ashim Kapoor
Dear Ashley, I do follow the part when it creates a local copy of $GLOBALS. When it unsets them, is there a subtlety of unset that it ONLY unsets system defined entries? Could you please explain this ? Thank you, Ashim

[PHP] $GLOBALS example script on php.net

2011-03-04 Thread Ashim Kapoor
Dear all, I was reading this page http://php.net/manual/en/reserved.variables.globals.php and I found the following script there : Here's a function which returns an array of all user defined global variables: ?php function globals() { $globals = $GLOBALS; foreach (array(