Dump an array to a file, instead of displaying it

Hello Sitepointers,

Long time no see. Well, for my latest project I have read a pretty big .json file (~18 MB) to an array using json_decode(). Not only it’s big but also pretty nested (around 8 levels).

For obvious reasons if I try var_dump() the browser freezes for quite some time, but eventually displays the dump.

I have to do this to another 10 or so (big) files. Is it possible to save the array to a text file instead of displaying it to the browser? I want them saved for future reference as I develop the app.

Thanks in advance for your time.

json already is a file… I’d personally download a tool such as jsonviewer and use that to view your files so you don’t have to do a var_dump on an already readable file.

hey cool! i didn’t know a tool like that existed. I tried working from the .json directly but it’s pretty messed up.

But that tool is exactly what i need! Thanx cpradio!