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.sperl...@gmail.com
http://sperling.com





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

Reply via email to