例如,在我的情况下,我已经有了数组的值......
array(1) {
[1]=>
array(1120) {
["2006-02-25"]=>
array(1) {
[0]=>
int(33)
}
["2006-02-20"]=>
array(1) {
[0]=>
int(38)
}
["2006-02-28"]=>
array(1) {
[0]=>
int(46)
}
结果我得到了这段代码
$explodeEndDate = explode(" ",$adEndDate);
$explodeStartDate = explode(" ", $adStartDate);
$StartDate = $explodeStartDate[0];
$NewStartDate = strtotime("$explodeStartDate[0]");
$NewEndDate = strtotime("$explodeEndDate[0]");
$timeDiff = abs($NewEndDate - $NewStartDate);
// 86400 seconds in one day
$NumberDays = $timeDiff/86400;
//convert into int
$NumberDays = intval($NumberDays);
if(array_key_exists($NumberDays, $array[$itemType]) == false){
$array[$itemType][$StartDate] =[$NumberDays];
}
}
我想要实现的是,在"$StartDate"
值中,例如["2006-02-28"]
,我想用它的值加上它。如果我们回头看上面的图是例如
["2006-02-25"]=>
array(1) {
[0]=>
int(33)
所以2006-02-25
是33
的加号,结果是2006-04-01
。之后,我想在该范围内制作日期