project3 Posted March 31, 2008 Share Posted March 31, 2008 I need to see all the session names and variables. I don't know the names of the session or i know how to get them. I know you would use a foreach loop but I can't quite get it figured out. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/ Share on other sites More sharing options...
pocobueno1388 Posted March 31, 2008 Share Posted March 31, 2008 <?php foreach ($_SESSION as $key => $val){ echo "$key - $val <br />"; } Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/#findComment-505315 Share on other sites More sharing options...
project3 Posted March 31, 2008 Author Share Posted March 31, 2008 cool thanks. Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/#findComment-505316 Share on other sites More sharing options...
redarrow Posted March 31, 2008 Share Posted March 31, 2008 try <?php foreach($_SESSION as $key=>$val){ echo "$key - $val <p></p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/#findComment-505318 Share on other sites More sharing options...
kenrbnsn Posted March 31, 2008 Share Posted March 31, 2008 You can also do: <?php echo '<pre>' . print_r($_SESSION, true) . '</pre>'; ?> to see all of the session variables. Ken Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/#findComment-505330 Share on other sites More sharing options...
redarrow Posted March 31, 2008 Share Posted March 31, 2008 ken code is so good and so obvious,dam im old. 10/10 ken...... You can also do: <?php echo '<pre>' . print_r($_SESSION, true) . '</pre>'; ?> to see all of the session variables. Ken Link to comment https://forums.phpfreaks.com/topic/98748-getting-all-session-variables/#findComment-505334 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.