Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP var_dump($_SESSION);

Tags:

php

I am working on a project and the $_SESSION['username'] was not echoing I used the var_dump and this is what I got back from that result my question is how do I fix it.

    array(4) {
 ["SESS_ID"]=> string(1) "2"
 ["SESS_FIRST_NAME"]=> string(7) "Kevin"
 ["SESS_LAST_NAME"]=> string(6) "Outerbridge"
 ["username"]=> string(0) "" } 

I am sort of new to this var_dump so I am not sure if it is in your forum I will relook at all that is posted.

like image 929
user807419 Avatar asked Oct 31 '25 19:10

user807419


2 Answers

PHP var_dump() function will display always null for $_SESSIONS. You can use :

 Print_r ($_SESSION);

Thought it may help, Have a nice one

like image 184
Mihai Nedelcovici Avatar answered Nov 02 '25 20:11

Mihai Nedelcovici


"Fix" what?

$_SESSION['username'] has the value "", or the empty string.

If that's not what you wanted, do whatever you need to do to make that not happen.

I'm sorry that this appears like a useless answer, but really it's a useless question.

like image 30
Lightness Races in Orbit Avatar answered Nov 02 '25 19:11

Lightness Races in Orbit