View All Sessions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

View All Sessions

Post by hawleyjr »

Is it possible to view all the current session variables?

In the same way you can view the contents of a variable by using:

[syntax=php]echo '<pre>'; print_r($myVar); echo '</pre>';[/syntax]

I would like to do the same but be able to view the session variables?
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Yep :D

Code: Select all

<?php
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
?>
Remember that all session values are held in the $_SESSION array. Same goes for $_POST, $_GET, $_SERVER and a few others.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Thanks a bunch,

Now that I look at your answer it was foolish of me to ask in the first place...I should have known that....thanks again.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

you can use the [php_man]print_r[/php_man]() function to dump any kind of arrays, even multi-dimensional arrays(arrays inside arrays :D)
Post Reply