Re: Array in Session-Vars?
| From: | elias | Date: | Fri, 30 Mar 2001 19:37:00 +0000 |
| Subject: | Re: Array in Session-Vars? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46243@lists.php.net to get a copy of this message | ||
I never tried to use arrays in session variables,
but i believe if you try to serialize the array first and then register the
serialized value as session value it should work.
and ofcourse to retrieve it do reverse work by unserializing the variable
back to the array and use it.
-
$a = Array("asdad", "adasd", "123123", "6adas f g");
echo ($s = serialize($a)) . "<br>";
// you can session_register($s)
unset($a);
// in file2 you can retrieve $s and make $a back again:
$a = unserialize($s);
var_dump($a);
-
-elias
""Thomas Häger"" <thomas.haeger@onsoft.de> wrote in message
news:9a1e71$eun$1@toye.p.sourceforge.net...
> Hi all,
>
> i need to use an array in a session variable.
> On a page i fill the Sessionvar :
> $HTTP_SESSION_VARS["xy"] []=$whatever
> (The var is registered with session_register("xy"))
> I mean that the entry would made at the end of the array, is it not so?
>
> But evrey time i proove the entries with count($HTTP_SESSION_VARS["xy"]) ,
> there are only one entry.
>
>
> Have somebody an idea?
>
> Thanks,
>
> Thomas
>
>
>
>
>
> --
> 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
>