3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime('2011-33-02'); $start->modify('first day of this month'); $end = new DateTime('2012-05-06'); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("Y-m") . PHP_EOL; }
based on KdQtb
Output for 7.0.28 - 7.3.0rc3
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character in /in/caHVt:2 Stack trace: #0 /in/caHVt(2): DateTime->__construct('2011-33-02') #1 {main} thrown in /in/caHVt on line 2
Process exited with code 255.
Output for 5.6.38
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character' in /in/caHVt:2 Stack trace: #0 /in/caHVt(2): DateTime->__construct('2011-33-02') #1 {main} thrown in /in/caHVt on line 2
Process exited with code 255.