Closed mebjas closed 10 years ago
But how does that effects, storing set data to this variable will ensure easy retrieval (rather than having to call a function). Also we are using no session_start()
so scope is limited to current page only.
To me this looks similar to setcookie()
& $_COOKIE
, one will use, $_SESSION
in their logic whenever they want to read it and $obj->setData()
to set the value for future use
Also accessing data from memory would be faster than, db access.
Not using session_start() is one of the problems, because if it is being used elsewhere, it will change the global variable without anyone knowing or noticing. And really, what is the difference between using the clean version of $session->getData('foo')
and the problematic $_SESSION['foo']
- additionally if you don't support writing to $_SESSION but have to use the method call.
you are actually right
Currently for retrieving session values we need to call getData(), however its better to store the values in $_SESSION array which is currently empty. It will result in easier access.