Jump to content

Archived

This topic is now archived and is closed to further replies.

xProteuSx

Display ALL session variable names and values

Recommended Posts

I am building a website that uses session variables extensively.  The site is getting a little complicated, and I am starting to lose track of which session variables are assigned, and what their values are.  Is there some way where I can create a piece of code that will display all of the existing session variables and their values?

Share this post


Link to post
Share on other sites
<?php
    session_start();
    
   echo "<h3> PHP List All Session Variables</h3>";
   foreach ($_SESSION as $key=>$val)
    echo $key." ".$val."<br/>";

?>

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.