Re: storing arrays
| From: | Clark | Date: | Mon, 18 Feb 2002 05:15:21 +0000 |
| Subject: | Re: storing arrays | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85153@lists.php.net to get a copy of this message | ||
I'm having trouble storing my array to a text file, utilizing serialize()
and unserialize(). Could you please show a very basic layout of the proper
way to serialize and unserialize and store that to a file? Thanks.
"Matt" <matt@epooch.com> wrote in message
news:001e01c1b7c0$404d5be0$059aa8c0@Pooch...
>
> ----- Original Message -----
> From: "Clark" <wiseguy316@netzero.com>
> Sent: Saturday, February 16, 2002 9:15 PM
>
>
> > Two questions:
> >
> > 1) Is it possible to write an array to a file?
>
> Yes, serialize it first with http://www.php.net/serialize. You
> can also
> place this in a db text field because it will be a character
representation.
>
> > 2) Is it possible to specify the name of the key to each item of an
array
> > when you get the array using file().
>
> When retrieving the saved array, unserialize it, and you'll get the same
> array back.
>