note 95966 deleted from language.variables.superglobals by danbrown

From: Date: Mon, 01 Feb 2010 15:25:15 +0000
Subject: note 95966 deleted from language.variables.superglobals by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165567@lists.php.net to get a copy of this message
Note Submitter: Brian dot Chandler dot Programmer at gmail dot com ---- 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 />'; } ?>

« previous php.notes (#165567) next »