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?
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?
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.
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.