Can anyone explain why when I run the following code
Code: Select all
<?php
print_r($GLOBALS);
?>
Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( ) [_FILES] => Array ( ) )
which is expected since register_globals is set to off and no variables are defined, but when I add the following code. which is just to echo out a variable from the superglobal $_SERVER, the print_r($GLOBALS) now outputs all the superglobal $_SERVER variables as if echo somehow made all the variables available to the script and now $GLOBALS sees them. maybe a stupid question I don't know. For obvious reasons I can't show the output, but it's easy enough to run the code to view your systems output.
Code: Select all
<?php
print_r($GLOBALS);
echo "<br />";
echo "<br />";
echo $_SERVER["DOCUMENT_ROOT"];
?>
Thanks,
steadythecourse