This page shows an example of how to read session variables in PHP. The following is the value of the session variable we created on this page, called "test_variable".
In order to be able to use session variables, we need to tell PHP that we want to use sessions on this page. To do this, we call the session_start() built-in function at the top of the script. We read the session variable called "test_variable" by using the $_SESSION['test_variable'] variable in PHP.
The following is the output from the command echo $_SESSION['test_variable'];