Want to know how to generate a formatted list with all globals (including custom ones)? Check out the code below.
<?php
$_CUSTOM = array('USERNAME' => 'john', 'USERID' => '18068416846');
$globals = array(
'$_SERVER' => $_SERVER, '$_ENV' => $_ENV,
'$_REQUEST' => $_REQUEST, '$_GET' => $_GET,
'$_POST' => $_POST, '$_COOKIE' => $_COOKIE,
'$_FILES' => $_FILES, '$_CUSTOM' => $_CUSTOM
);
?>
<html>
<style>
<?php ?>
.left {
font-weight: 700;
}
.right {
font-weight: 700;
color: #009;
}
.key {
color: #d00;
font-style: italic;
}
</style>
<body>
<?php
echo '<h1>Superglobals</h1>';
foreach ($globals as $globalkey => $global) {
echo '<h3>' . $globalkey . '</h3>';
foreach ($global as $key => $value) {
echo '<span class="left">' . $globalkey . '[<span class="key">\'' . $key . '\'</span>]</span> = <span class="right">' . $value . '</span><br />';
}
}
?>
</body>
</html>