Re: questions about $_SERVER

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

 



On Mar 11, 2012, at 3:04 PM, Tim Streater wrote:
> 
> In the following, $x is a global but not a super-global (AFAIK).
> 
> 
> <?php
> 
> function echox ()
>     {
> 
>     global $x;
> 
>     echo $x;
> 
>     }
> 
> $x = "Hello world\n";
> 
> echox ();
> 
> ?>
> 
> --
> Cheers  --  Tim


Tim:

I read somewhere that using:

global $x;

is not recommended. Whereas, it is recommended to use:

$x = $GLOBALS['x'];
echo $x;

In any event, what I found interesting is:

print_r($GLOBALS)

if will list all the variables (plus more) in your script. Thus, all variables in your main script are also included in the $GLOBALS array.

Cheers,

tedd

_____________________
tedd.sperling@xxxxxxxxx
http://sperling.com





-- 
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