Re: Possible to store arrays in session variables?
| From: | Papp Gyozo | Date: | Mon, 24 Sep 2001 22:26:26 +0000 |
| Subject: | Re: Possible to store arrays in session variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68613@lists.php.net to get a copy of this message | ||
Hi,
> Is it possible to store arrays inside of session variables?
yes, sure.
I always use the following function to store more complex
values in session:
function session_store($stored_name, $value)
{
global $HTTP_SESSION_VARS;
$$stored_name = $value;
$HTTP_SESSION_VARS[$stored_name] = $value;
session_register($stored_name);
}
// and its usage:
session_store('Crumbs', array(1,2));
>
> I mean is this a valid statement?
>
> $HTTP_SESSION_VARS["Crumbs"][0] = "1";
> $HTTP_SESSION_VARS["Crumbs"][1] = "2";
>
> foreach ($HTTP_SESSION_VARS["Crumbs"] as $k => $v) {
> echo "$v ->";
> }
>
> Regards,
> Johnny Nguyen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>