Jump to content

How save a multiarray so that it may be reloaded and used.


Go to solution Solved by Barand,

Recommended Posts

I am  trying to capture some data on the fly that is marked to be inserted in the db.. but its a huge dump and is very slow getting it into the db.but i can download the entire package and save it in text in less than 3 minutes.. so the idea is to capture it on the fly and then once off line move the data to the db.. should save hours of time and not tie up the MLS server so long.. So here is what i need..

Want to capture it on the fly which i can do.. but the question is how do i save it to txtfile so that it can easily be reloaded as an arrray in the future.

I can break it apart any way i like and add ticks or quotes or anything and save the pieces.. but surely there is a very efficient way to do if for multi array... as i think its important how its stored if say i winat to pull the arrays quickly from file usging something like
$str = file('mytextfile.txt');

Hope all this makes sense.. what follows is an example of sample code that i am experimenting with to see how to work this.. any thoughts or suggestions would be appreciated.


$contacts = [['name'=>'S Russell','email'=>'s.russell@vahud.com','title'=>'President'], 
             ['name'=>'D Randall','email'=>'d.Randall@vahud.com','title'=>''], 
             ['name'=>'T Joneses','email'=>'t.joneses@vahud.com','title'=>'Professor'], 
             ['name'=>'A Soloing','email'=>'a.soloing@vahud.com']];


Array
(
    [0] => Array
        (
            [name] => S Russell
            [email] => s.russell@vahud.com
            [title] => President
        )

    [1] => Array
        (
            [name] => D Randall
            [email] => d.Randall@vahud.com
            [title] => 
        )

    [2] => Array
        (
            [name] => T Jones
            [email] => t.jones@vahud.com
            [title] => Professor
        )

    [3] => Array
        (
            [name] => A Solo
            [email] => a.solo@vahud.com
        )

)


So how should the code be broken apart and placed in saving.. to easily be reloaded quickly exactly like the array it was since it will be fed back to the same program that it was taken from in midstream.

 

Thanks that worked perfect.. save it and retrieved it in the exact same state it was in originally... you guys are great..

Maddening you told me where fish and that helped but SEN threw me a couple of fish to get started and speeded up my process significantly as i would have had no idea where to start as i have never used json before.. so he wins.. but i really do appreciate the quick response from both of you.. This is one forum that yu always know you wont need to wait days for help.... Thanks agai.

Do you see where your name is at the top of your posts?

 

It doesn't say much for your abilities that you can't work out that our names are the same place in our posts as your name is in yours.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.