save ini
function save_ini($key,$value)
{
$ini_array = parse_ini_file("d.ini");
$ini_array[$key]=$value;
write_ini_file("d2.ini", $ini_array);
}
sharing some tech problems and soln
function save_ini($key,$value)
{
$ini_array = parse_ini_file("d.ini");
$ini_array[$key]=$value;
write_ini_file("d2.ini", $ini_array);
}
Posted by Sajjad at 1:27 pm 0 comments
function write_ini_file($path, $assoc_array) {
foreach ($assoc_array as $key => $item) {
if (is_array($item)) {
$content .= "\n[$key]\n";
foreach ($item as $key2 => $item2) {
$content .= "$key2 = \"$item2\"\n";
}
} else {
$content .= "$key = \"$item\"\n";
}
}
if (!$handle = fopen($path, 'w')) {
return false;
}
if (!fwrite($handle, $content)) {
return false;
}
fclose($handle);
return true;
}
Posted by Sajjad at 1:10 pm 0 comments