3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime('2014-01-07', new DateTimeZone('UTC')); $end = clone $start; $start->sub(new DateInterval('P1M')); // substract one month echo $start->format('r').' - '.$end->format('r'); print_r($end->diff($start)); print_r($start->diff($end));

preferences:
60.53 ms | 402 KiB | 5 Q