Skip to content

Instantly share code, notes, and snippets.

@zabbarob
Created December 31, 2013 19:04
Show Gist options
  • Save zabbarob/8200929 to your computer and use it in GitHub Desktop.
Save zabbarob/8200929 to your computer and use it in GitHub Desktop.
Web page that prints out the contents of most predefined variables in PHP.
header('Content-Type: text/plain');
function echoAll($a, $n) {
if ($a) {
echo join(PHP_EOL, array_map(function($key) use ($a, $n) {
return $n . "['$key'] = '$a[$key]';";
}, array_keys($a))), PHP_EOL;
}
}
echoAll($_SERVER, '$_SERVER');
echoAll($_GET, '$_GET');
echoAll($_POST, '$_POST');
echoAll($_COOKIE, '$_COOKIE');
echoAll($_FILES, '$_FILES');
echoAll($_REQUEST, '$_REQUEST');
echoAll($_SESSION, '$_SESSION');
echoAll($_ENV, '$_ENV');
exit('DEBUGGING');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment