I want to create a DatePeriod object with a negative DateInterval.
This creates a DatePeriod with the year increasing from today to 2016.
$this->S
I tried it myself and it isn't possible with DatePeriod
alone, but I think that makes sense: It just reflects the periods, that usually doesn't have any specific order and therefore cannot get reordered (it can be treated as a set).
The only way to retrieve the dates and sort it in reversed order, as far as I can see, is something like this
$result = array();
forech ($dateperiod as $date) {
array_push ($result, $data);
}
Update
$date = new DateTime('2016-06-06');
$i = new DateInterval('P1Y');
$now = new DateTime;
while ($date >= $now) {
echo $date->format('c') . PHP_EOL;
$date = $date->sub($i);
}