note 95966 added to language.variables.superglobals
| From: | Brian dot Chandler dot Programmer at gmail dot com | Date: | Mon, 01 Feb 2010 01:25:50 +0000 |
| Subject: | note 95966 added to language.variables.superglobals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165537@lists.php.net to get a copy of this message | ||
Here's a quick and nifty way to see the guts of all these if learning or to aid in debugging.
Just copy and paste the below code to see everything on one page. I used a Variable variable with a
foreach loop to keep short. Bear in mind that inside the $GLOBALS superglobal, the $superglobals
array and $var values will be in there due to the script itself. Hope it helps. :)
<?php
//Array of variable names.
$superglobals = array(
'GLOBALS',
'_SERVER',
'_GET',
'_POST',
'_FILES',
'_COOKIE',
'_SESSION',
'_REQUEST',
'_ENV'
);
foreach($superglobals as $var){
//<pre> is to make sure we see as formatted by print_r().
echo 'Entire $' . $var . ' array:<pre>';
print_r($$var); //Prints the Variable variable. :)
echo '</pre><br /><br />';
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 71.76.253.27
----
Manual Page -- http://www.php.net/manual/en/language.variables.superglobals.php
Edit -- https://master.php.net/note/edit/95966
Del: integrated -- https://master.php.net/note/delete/95966/integrated
Del: useless -- https://master.php.net/note/delete/95966/useless
Del: bad code -- https://master.php.net/note/delete/95966/bad+code
Del: spam -- https://master.php.net/note/delete/95966/spam
Del: non-english -- https://master.php.net/note/delete/95966/non-english
Del: in docs -- https://master.php.net/note/delete/95966/in+docs
Del: other reasons-- https://master.php.net/note/delete/95966
Reject -- https://master.php.net/note/reject/95966
Search -- https://master.php.net/manage/user-notes.php