> I would like to read and write user-settings to a keyword-value file and > be > able to extract it. The following code works fine but i wondered if there > was a more elegant/direct way of doing this.
For reading, parse_ini_file() is elegant and direct. Writing is another matter. If you are getting your data through a form, you can loop through the $_POST array and write key=>value pairs to the file that can later be read by parse_ini_file(). I've got a small class that will read a php.ini style file and convert all of the variable=value pairs into form elements. It'll take the submitted form and re-write the .ini file with whatever you submit. You could probably adapt that to your needs. Email me offlist if you want a copy. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php