Re: $GLOBALS example script on php.net

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

 



On 5 March 2011 05:44, Ashim Kapoor <ashimkapoor@xxxxxxxxx> 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
> function globals() {
> Â Â$globals = $GLOBALS;
> Â Âforeach (array(
> Â Â Â Â'GLOBALS',
> Â Â Â Â'_ENV',
> Â Â Â Â'HTTP_ENV_VARS',
> Â Â Â Â'_POST',
> Â Â Â Â'HTTP_POST_VARS',
> Â Â Â Â'_GET',
> Â Â Â Â'HTTP_GET_VARS',
> Â Â Â Â'_COOKIE',
> Â Â Â Â'HTTP_COOKIE_VARS',
> Â Â Â Â'_SERVER',
> Â Â Â Â'HTTP_SERVER_VARS',
> Â Â Â Â'_FILES',
> Â Â Â Â'HTTP_POST_FILES',
> Â Â Â Â'_REQUEST'
> Â Â) as $var) {
> Â Â Â Âunset($globals[$var]);
> Â Â}
>
> Â Âreturn $globals;
> }
> ?>
>
> I think that this script UNSETS each supergobal variable,but page says that
> it returns ALL user defined vars ? Can some one tell me how that is ?
>
> Thank you,
> Ashim
>

You are right. The user note is incorrect.

I'll remove it.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[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