How to print all session variables currently set?

Viewed 272665

Without having to call each session variable by name, is there a way to display the content of all the session variables currently set?

7 Answers
session_start();
echo '<pre>';var_dump($_SESSION);echo '</pre>';
// or
echo '<pre>';print_r($_SESSION);echo '</pre>';

NOTE: session_start(); line is must then only you will able to print the value $_SESSION

Echo the session object as json. I like json because I have a browser extension that nicely formats json.

session_start();
echo json_encode($_SESSION);
Related