below is some code I am using to \"translate\" a map array into SQL code so I can easily update my database when I have updated my game map. As you can see it prints out the
That should be quite simple. Add
// second parameter 'a' stands for APPEND
$f = fopen('/path/to/the/file/you/want/to/write/to', 'a');
to the beginning of your script.
Add
fclose($f);
to the end fo your script to cleanly close the file handle (good pratice even though handles would be closed the the terminating script automatically).
And the change all your echo
's and print
s to
fwrite($f, '<>');
EDIT:
That way you can even compress the data on the fly using a compression stream wrapper if amnount of data gets really large.