PHP – Code to Display Request and Post Variables

Posted on Posted in Web Development

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

Your email address will not be published. Required fields are marked *