$today = date(“Ymd”);
$file = example;
$getOldValue = parse_ini_file($file, 1);
if($getOldValue[$today] = ‘ ‘){
$somecontent = $today . “= 0n”;
if (!$handle = fopen($file, ‘a’)) {
echo “Cannot open file ($file)”;
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo “Cannot write to file ($file)”;
exit;
}
fclose($handle);
}
$newValue = $getOldValue[$today] + 1;
$proConf = file_get_contents($file);
$replace = preg_replace(‘($today = ?)’, ‘
file_put_contents($file, $replace);
I want to use this to do:
example:
20060301 = 3
20060302 = 23
to example:
20060301 = 3
20060302 = 24
What I want to print
where $today_from_example = $today{
$today = $oldvalue + 1
}
I have been looking at the preg_replace examples but I don’t understand the syntax that it is using and if the date is not in the file I want to add it.
Thanks for the help