INI Files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I've been using the very convenient function parse_ini_file() to read
an ini file into a 2d array as follows:

$ini_array = parse_ini_file("sample.ini", true);

Say I modify the contents of this array and I want to write it back to
the original file. What is the best way to do this?

Thanks for any help.

Re: INI Files

Quoted text here. Click to load it

call textbox with names like sectionname[key]
after that do some simple foreach and write manualy file contents

Re: INI Files

Unfortunately there isn't a built-in function for writing back to a INI
file. I am sure there are plenty of solutions in the user-contributed
note section in the PHP manual though. Writing your function wouldn't
be hard either, if the parameter/value pairs are not arbituary.

Site Timeline