Hi, I currently have a file named config.cfg. In it I have an array containing configuration settings like so:
conf['db_host'] = "xxx";
conf['db_username'] = "xxx";
conf['db_password'] = "xxx";
conf['db_database'] = "xxx";
// etc...
I have absolutely no problem loading the file and the running it's contents by using eval().
The problem comes when I want to edit it. I want to be able to store the current array with the name of it's keys intact and then modify them and then overwrite the existing file.
I have a good idea of what I am going to do to accomplish the task - probably using regular expressions and eval(), but if anybody has done something like this before, please, I would really like to hear your experience and advice on how to tackle such a problem.
But I do have a practical question: How would I get the names of the keys of an array, so that I can write them as a string into the file?