Here is part one of better testing and debugging.
Reserved variables are often structured as arrays. I saw a recent note on the PHP documentation site that made me cringe:
http://us2.php.net/manual/en/reserved.variables.server.php#91080
This is a very painstaking approach for viewing all that information.
I didn’t count how many lines there were in that, but…
There is a simple way to do the same thing:
foreach($_SERVER as $k => $v){
echo "<strong>".$k."</strong> = <em>".$v."</em><br />";
}
Why not test all reserved variables at once?!
<?php
$reserved=array(
"GET"=>$_GET,
"POST"=>$_POST,
"SERVER"=>$_SERVER,
"SESSION"=>$_SESSION,
"COOKIE"=>$_COOKIE
);
foreach($reserved as $a => $r){
echo "<h2>\$_".$a."</h2><p>";
foreach($r as $k => $v){
echo "\$_".$a."[<strong>".$k."</strong>]"
."= <em>".$v."</em><br />";
}
echo "</p>";
}
?>
