PHP循环通过日期会导致错误[重复]

This question is an exact duplicate of:

Can anyone tell me why the following fails when the date is >= 2013-01-06

It's so weird, when ever the date is after this date the script works perfectly but anything before and I get the white screen of death!

<?php 

use Carbon\Carbon;

$startDate    = Carbon::createFromFormat('Y-m-d', '2013-01-06');
$current_week = Carbon::now()->timestamp;

/*
$startDate    = strtotime('2013-01-06');
$current_week = strtotime(date('Y-m-d'));
*/

$weeks        = array();
$w            = 0;

while($startDate < $current_week){
    $weeks[$w] = array(
        'monday' => $startDate->startofWeek()->format('d/m/Y'), 
        'sunday' => $startDate->endofWeek()->format('d/m/Y')
    );
    $w++;
    $startDate = $startDate->addDays(1); // Move it on to the following week
}

var_dump($weeks);

?>

Please can someone help me?!

</div>

This ? We compare timestamp with timestamp, not a datetime object with timestamp, I don't know Carbon class, here $startDate->timestamp must be replaced by the method converting carbon datetime object to unix timestamp.

<?php 

use Carbon\Carbon;

$startDate    = Carbon::createFromFormat('Y-m-d', '2013-01-06');
$startDateTimestamp = $startDate->timestamp;
$current_week = Carbon::now()->timestamp;

/*
$startDate    = strtotime('2013-01-06');
$current_week = strtotime(date('Y-m-d'));
*/

$weeks        = array();
$w            = 0;

while($startDateTimestamp < $current_week){
    $weeks[$w] = array(
        'monday' => $startDate->startofWeek()->format('d/m/Y'), 
        'sunday' => $startDate->endofWeek()->format('d/m/Y')
    );
    $w++;
    $startDate = $startDate->addDays(7); // Move it on to the following week
    $startDateTimestamp = $startDate->timestamp;
}

var_dump($weeks);

?>