generate_ini

string generate_ini (array inidata [, string comments])

Transforms the multidimensional array inidata in a string that can be saved directly as an INI file. comments may optionally be added to the beginning of the INI string. To parse an INI string into an array, use parse_ini().

Example

$inifile = "app.ini";
$config = parse_ini(file_get_contents($inifile));
$config["Settings"]["defaultpath"] = dirname(__FILE__);
$initext = generate_ini($config, "; Configuration file\r\n");
file_put_contents($inifile, $initext); 


See also

parse_ini
Auxiliary functions