On Oct 20, 2009, at 6:05 PM, Leam Hall wrote:
Down the road I'll get this going in a database, but at the moment
I'm stuck using flat files to store multi-dimensional array data. So
I have a file that gets imported, is used and potentially changed,
and then needs to be written back to a file if any data changed.
Is there a good way to do this other than just iterate through each
array?
Sounds like a job for json_encode/json_decode.
You could use serialize(), but serialize() can have problems with
multibyte characters.
json_[de|en]code will create nice, concise, strings.
The advantage of serialize() over the json functions is that serialize
can serialize objects, and you'll actually get them back (assuming the
class has been defined when you call unserialize()
-Tim
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org/Show-Participation