Welcome Guest, Not a member yet? Register   Sign In
Using $_SESSION vs $this->session
#5

Yes, accessing $_SESSION directly is technically more efficient.

(09-30-2016, 06:52 PM)daveĀ friend Wrote: The retrieval functions $this->session->item and $this->session->userdata('item') have an advantage over $_SESSION['item'] in that the class functions return NULL if the item does not exist in the $_SESSION array. Directly reading from $_SESSION means you need to make sure the item exists before trying to access the array. Now that gets tedious.

The advantage of using a framework like CI is that a lot of that kind of tedium is eliminated. Why not use what the framework provides?

I'm not saying that this is false, but it is highly subjective.

You shouldn't use what the framework provides for its own sake, you should use it if it helps you.
Reply


Messages In This Thread
Using $_SESSION vs $this->session - by Cannondale - 09-30-2016, 03:18 PM
RE: Using $_SESSION vs $this->session - by Narf - 10-03-2016, 12:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB