Re: passing arrays to a session-variable
| From: | Joshua Moore-Oliva | Date: | Fri, 28 Feb 2003 13:49:15 +0000 |
| Subject: | Re: passing arrays to a session-variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137568@lists.php.net to get a copy of this message | ||
Try looking at this page
http://www.php.net/manual/en/function.serialize.php
Josh.
On February 28, 2003 08:22 am, Michiel van Heusden wrote:
> I'm using this script to test passing arrays to a Session-variable.
>
> <?
> session_start();
>
> // method 1
> $_SESSION['array1'] = array("item1", "item2");
>
> // method 2
> session_register("array2");
> $array2 = array("itemA", "itemB");
>
> header ("Content-type: text/html");
>
> echo $array1[0]. "<br />";
> echo $array2[0];
> ?>
>
> method 1 doesn't work until another PHP is loaded, only then the var is
> ouputted...
> method 2 works fine, but i'd prefer using $_SESSION all the way instead of
> session_register
> any suggestions?
>
> grace
> michiel