PHP – Code to Display Request and Post Variables

Sometimes while debugging a PHP application it is handy to display request and post variables. Here is the code that will do that:

foreach($_POST as $var=>$val)
{
 echo "$var=$val";
}

Replace POST with SESSION and it’ll work for the session variables. You can do the same with GET, but probably don’t need it.

Leave a Reply