Re: Re: Sessions

From: Date: Mon, 15 Sep 2008 17:48:27 +0000
Subject: Re: Re: Sessions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-280206@lists.php.net to get a copy of this message
On 15 Sep 2008, at 17:03, ANR Daemon wrote:
Plus you can access and manipulate the session array just like you could any other array.
Pure truth.
No it's not. Please see my earlier response to the OP - there are restrictions that do not exist for normal arrays. -Stut Stut is right this is a note from the manual for e.g.:
It is currently impossible to register resource variables in a session. For example, you cannot create a connection to a database and store the connection id as a session variable and expect the connection to still be valid the next time the session is restored. PHP functions that return a resource are identified by having a return type of /resource/ in their function definition. A list of functions that return resources are available in the resource types <http://uk2.php.net/manual/en/resource.php> appendix. http://uk2.php.net/manual/en/function.session-register.php Not to mention that you cannot register an array into session that is indexed numerically. But you can do that in multi-dimensional arrays in bigger than the first level indexing if that is the right term. For e.g. you can do this: $_SESSION['test'][1] = 14; $_SESSION['test'][2] = 'string'; But you can't do this: $_SESSION[1] = 'test'; $_SESSION[5] =3; It probably wont work. Not tested though. -- Thodoris

« previous php.general (#280206) next »