I just want to quickly store an array which I get from a remote API, so that i can mess around with it on a local host.
So:
- I currently have an array.
- I want to people to use the array without having to get it from the API.
There are no needs for efficiency etc here, this isnt for an actual site just for getting some sanitizing/formatting methods made etc
Is there a function like store_array() or restore_arrray() ?!
The best way to do this is JSON serializing. It is human readable and you’ll get better performance (file is smaller and faster to load/save). The code is very easy. Just two functions
Example code:
You can write your own store_array and restore_array functions easily with this example.
For speed comparison see benchmark originally from Preferred method to store PHP arrays (json_encode vs serialize).