I want to code a few PHP pages, which reads and write some settings from a config.php file. The structure of config.php file
config["exp-date"] = '10-09-2011';
config["np"] = 3;
I can just include the file and read the settings, but is there any easy way to change settings via a form. I know of fopen and other, but still not getting what to do after opening.
Update: How can I read the whole array at once?
Say you have the $config var set inside your config.php (btw be careful with the var name, it’s very common and you don’t want it to be overwrited).
All you have to do is to modify the $config array with your form (this part is up to you), and then, write the new $config array in the config.php file like this:
And that’s it! 🙂