Save some time with $_SERVER variables

I spend a lot of time testing out certain things with $_SERVER array.  I often forget what I should be getting as a value for a specific variable.  Sometimes what variable it is that I am wanting to work with.  Here’s a quick loop that can generate the $_SERVER array all nice and neat like:

  1. foreach ($_SERVER as $variable => $value) {
  2. 	echo $variable . " = " . $value . "<br />";
  3. }

To jazz it up, you can add unordered list elements or tables to it.  What’s not to love?

Posted in PHP Tutorials | Tagged as ,

Leave a Reply