Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created February 13, 2017 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/7c506394e0245c62edb8f52954f116b2 to your computer and use it in GitHub Desktop.
Save strangerstudios/7c506394e0245c62edb8f52954f116b2 to your computer and use it in GitHub Desktop.
Dump the PHP $_SERVER variable for testing.
//navigate to /?test=1 to view the $_SERVER variables
//be sure to remove this code when finished
if(!empty($_REQUEST['test'])) {
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
exit;
}
@TrevorLeeman
Copy link

TrevorLeeman commented Sep 29, 2019

This also works for $_SERVER dump without bothering with URL param.

<?php
   foreach($_SERVER as $key => $value){
      echo "<tr><td>" . $key . ":</td><td>" . $value . "</td><tr>";
   }
   exit;
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment