看看这样子行不?
<?php
$num = 10;//基数
$add = 5;//增幅
$sdate = "2005-06-01";//开始日期
$ndate = date( "Y-m-d" );//现在的日期//一周以七天算。
$out = $num+$add*floor( ( strtotime( $ndate) - strtotime( $sdate ) ) / (60*60*24*7) );
echo $out;
?>
<?php
$num = 10;//基数
$add = 5;//增幅
$sdate = "2005-06-01";//开始日期
$ndate = date( "Y-m-d" );//现在的日期//一周以七天算。
$out = $num+$add*floor( ( strtotime( $ndate) - strtotime( $sdate ) ) / (60*60*24*7) );
echo $out;
?>
floor( ( strtotime( $ndate) - strtotime( $sdate ) ) / (60*60*24*7) )作为终点就可以了。如:
$w = floor( ( strtotime( $ndate) - strtotime( $sdate ) ) / (60*60*24*7) );
for( $i = 0; $i < $w; $i++ ) {
echo $out = $num + $add * $i;
}
$temp_sub = $gtrw[sub] ;for( $i = 1; $i <= $times+1; $i++ ) { $flat =( strtotime( $statfortime) - strtotime( "2006-03-27" ) ) / (60*60*24*7) ;
if(is_int( $flat)){
$gtrw_sub = sprintf("%.00f",$temp_sub);
} else {
$gtrw_sub = sprintf("%.00f",$temp_sub + $i);
}
}