Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Saving arrays in file

General discussions related to php

Moderators: macek, egami, gesf

Saving arrays in file

Postby ppera » Wed Jan 15, 2003 6:56 am

Is there some (elegant) way to save arrays directly in files?
I solved it so that I saved content as string, and when use it in script I convert back to array with explode.
Of course there is need for load arrays too.
User avatar
ppera
New php-forum User
New php-forum User
 
Posts: 11
Joined: Thu Jan 09, 2003 2:11 pm

Re: Saving arrays in file

Postby WiZARD » Wed Jan 15, 2003 11:43 pm

You may use serialize function:
$a = serialize(array);
and save into file.
but if you need red from file use unserialize

P.S.
In this situation to you not need use exploede.....
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron