你能试试这个吗?
$invoicedate = strtotime("2013/09/01");
$TodayDate = strtotime('today');
$timeDiff = abs($TodayDate - $invoicedate);
$numberDays = $timeDiff/86400; // 86400 seconds in one day
$numberDays = intval($numberDays);
$noOfdaysToCheck ="30";
$total ="1000";
if ($numberDays >= $noOfdaysToCheck){$late = (1.5 / 100) * $total; }
每 30 天费用计算:请更新我,这是您预期的吗?
$invoicedate = strtotime("2013/07/01");
$TodayDate = strtotime('today');
$timeDiff = abs($TodayDate - $invoicedate);
$numberDays = $timeDiff/86400; // 86400 seconds in one day
$numberDays = intval($numberDays);
$noOfdaysToCheck ="30";
$Fees ="600";
if ($numberDays >= $noOfdaysToCheck){
$Interval = $numberDays%$noOfdaysToCheck;
for($i=1;$i<=$Interval;$i++){
$late = (1.5 / 100) * $Fees;
$Fees = FeesCalc($Fees);
}
}
$Fees = number_format($Fees, 2, '.', '');
echo $Fees;
function FeesCalc($Fees){
$late = (1.5 / 100) * $Fees;
return $TotalFees = $late+$Fees;
}