Know all $ _SESSION

0

I have a question and I searched and found in no corner an answer, I was wondering if it is possible to give echo $_SESSION and know all the session that my browser has at that moment and if yes like?     

asked by anonymous 12.07.2018 / 04:21

2 answers

4

You can use var_dump or print_r , like this:

<?php
session_start();

var_dump($_SESSION);

Or so:

<?php
session_start();

print_r($_SESSION);
The print_r is easier to read, because it contains less details, idela for who only wants to see the same content, since var_dump is ideal to analyze variables, values, such as strings, int, float, size and etc.

    
12.07.2018 / 04:28
0

As Guilherme said above, if you just want to see, print_r or var_dump will follow. If you want to use it in your application, just keep in mind that for all intents and purposes the $ _SESSION variable can be treated as a common PHP array.

    
12.07.2018 / 07:05