With CodeIgniter 3.0.3, the documentation states that session data can be retrieved a few different ways, including $_SESSION['item']
and $this->session->item
. It's true. No matter how I set the session variable, I see that I can echo the value both ways.
Now, with that session variable populated, I can check for empty condition like this: if(empty($_SESSION['item']))
, and it evaluates as bool(false)
just as I would expect. However, if I check the same session variable in this manner: if(empty($this->session->item))
it evaluates as bool(true)
, which is NOT what I expect (since I can echo its value on the very next line). Why are these two different ways of checking for empty condition being evaluated differently?