Re: store array in a file?
| From: | Keyur Kalaria | Date: | Mon, 16 Apr 2001 08:17:05 +0000 |
| Subject: | Re: store array in a file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48721@lists.php.net to get a copy of this message | ||
Hello Jaxon,
use serialize() & unserialize() as follows:
$store_in_file=serialize(your_array);
//and store the details of $store_in_file in your file/database.
//while retrieving read the data from file/database into store_in_file and
then use the following.
$retrieve_from_file=unserialize($store_in_file);
$retrieve_from_file will be similar to "your_array"
read the php4.0 & greater manual you will find these functions to be very
helpful..
hope this serves your purpose.
regards
Keyur
$$$$$$$
----- Original Message -----
From: "jaxon" <jaxon@salamander.net>
To: <php-general@lists.php.net>
Sent: Monday, April 16, 2001 5:02 AM
Subject: [PHP] store array in a file?
>
> Hey all, can someone make a recommendation here?
>
> I want to keep site structural info pulled from a database in an array,
and
> store it in a flat file that can eliminate the database hit.
>
> Then I'll just delete the file when structure changes, and regenerate it
> with a call to a recreation script that does the necessary sql once.
>
> So
> - does this make sense?
> - how to sore the array in a flat file
> - any way to make the array global once loaded?
>
> Thanks for any pointers!
>
> cheers,
> jaxon
>
>
> --
> 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
>
>