预期输入:
getDatesFromRange( '2010-10-01', '2010-10-05' );
预期产量:
Array( '2010-10-01', '2010-10-02', '2010-10-03', '2010-10-04', '2010-10-05' )
您还可以查看DatePeriod类:
$period = new DatePeriod( new DateTime('2010-10-01'), new DateInterval('P1D'), new DateTime('2010-10-05') );
这应该使您具有DateTime对象的数组。
进行迭代
foreach ($period as $key => $value) { //$value->format('Y-m-d') }