PHP – List all the variables in stored in the $_SESSION

I am developing an application which uses $_SESSION to hold a number of variables. The SESSION, as you may know, is a super golbal and holds the stored values in an associative array. I was wondering what I had stored in the SESSION at one point and decided to list what was held in the session. I have included the code that I used for this. If you think there is a better way or have a different method leave a comment.

1
2
foreach ($_SESSION as $key=>$val)
    echo '<pre>'.$key." ".$val.'

‘;

0 Be the first to like this.