SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Gonik's Avatar
    Join Date
    May 2005
    Location
    Thessaloniki, Greece
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.
    Don't Drink & Surf The Net

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,234
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Enthusiast Gonik's Avatar
    Join Date
    May 2005
    Location
    Thessaloniki, Greece
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!
    Don't Drink & Surf The Net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •