How to print all session variables currently set

0 votes
Without having to call each session variable by name, is there a way to display the content of all the session variables currently set?
Oct 19, 2020 in PHP by kartik
• 37,520 points
10,329 views

1 answer to this question.

0 votes

Hello @kartik,

Use this:

echo '<pre>';
var_dump($_SESSION);
echo '</pre>';

Or you can use print_r if you don't care about types. If you use print_r, you can make the second argument TRUE so it will return instead of echo, useful for...

echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>';

Hope it works!!

answered Oct 19, 2020 by Niroj
• 82,880 points

Related Questions In PHP

0 votes
1 answer

How to set up file permissions for Laravel?

Hello @kartik, The permissions for the storage and vendor folders should stay ...READ MORE

answered Apr 20, 2020 in PHP by I Navin
• 220 points
4,352 views
0 votes
1 answer

How to query all the GraphQL type fields without writing a long query?

Hello @kartik, GraphQL query format was designed in order ...READ MORE

answered Apr 20, 2020 in PHP by Niroj
• 82,880 points
1,599 views
0 votes
1 answer

How to select all records from one table that do not exist in another table?

Hello @kartik, You can either do like this: SELECT ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,880 points
53,084 views
0 votes
1 answer

How to get all columns' names for all the tables in MySQL?

Hello @kartik, Try this: select * from information_schema.columns where table_schema ...READ MORE

answered Aug 19, 2020 in PHP by Niroj
• 82,880 points
2,563 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
22,958 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,969 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,900 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
44,398 views
0 votes
1 answer

How to check if php session is already started or not?

Hello kartik, Use session_id(), it returns an empty string ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,880 points
5,684 views
0 votes
1 answer

How to Debug Variables like in PHP var_dump()?

Hello @kartik, Try out with the Smarty Session: {$smarty.session|@debug_print_var} or {$smarty.session|@print_r} To ...READ MORE

answered Apr 20, 2020 in PHP by Niroj
• 82,880 points
1,517 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP