In my project, I have a wrapper class for $_SESSION, so I can access session variables with $session->var. I tried to check if session variables were set or not using isset:
if (!isset($this->session->idUser)) {
...
}
but issetreturns nothing. Therefore, in my wrapper class, I wrote the following function to check what happens.
public function isItSet($var)
{
die(isset($_SESSION["id"]));
}
this results in a blank page. I tried:
public function isItSet($var)
{
die(is_null(isset($_SESSION["id"])));
}
still blank page. Then I tried:
public function isItSet($var)
{
die(isset($_SESSION));
}
This returns 1.
Can someone tell me why trying to check if the session variable is set does not return anything?
source
share