How to print all SESSION variables in PHP

In this Post I will explain how to print all $_SESSION variables in php.By using foreach and looping through $_SESSION you can print all session variables.alternatively you can use printr to print in array format
 <?php   
 session_start();  
 echo '<table>';  
 foreach ($_SESSION as $key => $value) {  
      echo '<tr><td>'.$key.'</td><td>'.$value.'</td></tr>';  
 }  
 echo '</table>';  
 ?>  

 <?php   
 session_start();  
 printr($_SESSION);  
 ?> 

Output:
all session variables will be printed in table format.


0 Response to "How to print all SESSION variables in PHP"

Post a Comment