RE: [PHP] native vs. phplib sessions

From: Date: Mon, 07 Apr 2003 16:46:02 +0000
Subject: RE: [PHP] native vs. phplib sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142717@lists.php.net to get a copy of this message
> CPT John W. Holmes wrote: > > What benefits do you feel that you get from this? Just curious... > One benefit could be that you can encapsulate data better. If you have a > session class and some method that does something to its data you can > use that method instead of accessing the data directly. That way if the > structure of your session data changes, you only have to change the way > it is accessed in one place. Of course could write a function that does > this as well. I like the 'organization' that classes create. Whether your class operates on the $_SESSION array or your own array, what's the difference? I don't see a benefit here. > Another possible benefit is more control. For example, I am not sure if > there is a function that will 'save' a builtin session. Anybody know? > This could be nice if you want to 'save' a session before a script > terminates. Or there might be a situation where you don't want to 'save' > it. http://www.php.net/manual/en/function.session-write-close.php I'll admit that before $_SESSION came along, sessions were a pain. All you do is call session_start() and then use $_SESSION like any other variable and it's contents will be available on any page with session_start(). How much easier can it be? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#142717) next »