rendered paste bodyfunction array_2_ini($array, $fname = "")
{
if(strlen($fname) == 0)
$fname = time() . ".ini";
$num_sections = count($array);
$section_names = array_keys($array);
$output = "; header thingy\n\n"; // our lil header ;)
for($x = 0; $x < $num_sections; $x++)
{
$this_name = $section_names[$x];
$output .= "[" . $this_name . "]\n";
for($b = 0; $b < count($array[$this_name]); $b++)
{
$key_names = array_keys($array[$this_name]);
$output .= $key_names[$b] . "=" . $array[$this_name][$key_names[$b]]."\n";
}
}
//-- set the file contents
$handle = fopen($fname, "w");
fwrite($handle, $output, strlen($output));
fclose($handle);
return true;
}