3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime('first day of this month'); $end = new DateTime('first day of next month'); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("l Y-m-d") . PHP_EOL; }
Output for 5.6.28, 7.0.14 - 7.1.0
Thursday 2015-01-01 Friday 2015-01-02 Saturday 2015-01-03 Sunday 2015-01-04 Monday 2015-01-05 Tuesday 2015-01-06 Wednesday 2015-01-07 Thursday 2015-01-08 Friday 2015-01-09 Saturday 2015-01-10 Sunday 2015-01-11 Monday 2015-01-12 Tuesday 2015-01-13 Wednesday 2015-01-14 Thursday 2015-01-15 Friday 2015-01-16 Saturday 2015-01-17 Sunday 2015-01-18 Monday 2015-01-19 Tuesday 2015-01-20 Wednesday 2015-01-21 Thursday 2015-01-22 Friday 2015-01-23 Saturday 2015-01-24 Sunday 2015-01-25 Monday 2015-01-26 Tuesday 2015-01-27 Wednesday 2015-01-28 Thursday 2015-01-29 Friday 2015-01-30 Saturday 2015-01-31
Output for 5.5.24, 5.5.35, 5.6.21, 7.0.6
Sunday 2016-05-01 Monday 2016-05-02 Tuesday 2016-05-03 Wednesday 2016-05-04 Thursday 2016-05-05 Friday 2016-05-06 Saturday 2016-05-07 Sunday 2016-05-08 Monday 2016-05-09 Tuesday 2016-05-10 Wednesday 2016-05-11 Thursday 2016-05-12 Friday 2016-05-13 Saturday 2016-05-14 Sunday 2016-05-15 Monday 2016-05-16 Tuesday 2016-05-17 Wednesday 2016-05-18 Thursday 2016-05-19 Friday 2016-05-20 Saturday 2016-05-21 Sunday 2016-05-22 Monday 2016-05-23 Tuesday 2016-05-24 Wednesday 2016-05-25 Thursday 2016-05-26 Friday 2016-05-27 Saturday 2016-05-28 Sunday 2016-05-29 Monday 2016-05-30 Tuesday 2016-05-31
Output for 5.5.25 - 5.5.30, 5.5.34, 5.6.8 - 5.6.14, 5.6.20, 7.0.5
Friday 2016-04-01 Saturday 2016-04-02 Sunday 2016-04-03 Monday 2016-04-04 Tuesday 2016-04-05 Wednesday 2016-04-06 Thursday 2016-04-07 Friday 2016-04-08 Saturday 2016-04-09 Sunday 2016-04-10 Monday 2016-04-11 Tuesday 2016-04-12 Wednesday 2016-04-13 Thursday 2016-04-14 Friday 2016-04-15 Saturday 2016-04-16 Sunday 2016-04-17 Monday 2016-04-18 Tuesday 2016-04-19 Wednesday 2016-04-20 Thursday 2016-04-21 Friday 2016-04-22 Saturday 2016-04-23 Sunday 2016-04-24 Monday 2016-04-25 Tuesday 2016-04-26 Wednesday 2016-04-27 Thursday 2016-04-28 Friday 2016-04-29 Saturday 2016-04-30
Output for 5.5.31 - 5.5.33, 5.6.15 - 5.6.19, 7.0.0 - 7.0.4
Tuesday 2016-03-01 Wednesday 2016-03-02 Thursday 2016-03-03 Friday 2016-03-04 Saturday 2016-03-05 Sunday 2016-03-06 Monday 2016-03-07 Tuesday 2016-03-08 Wednesday 2016-03-09 Thursday 2016-03-10 Friday 2016-03-11 Saturday 2016-03-12 Sunday 2016-03-13 Monday 2016-03-14 Tuesday 2016-03-15 Wednesday 2016-03-16 Thursday 2016-03-17 Friday 2016-03-18 Saturday 2016-03-19 Sunday 2016-03-20 Monday 2016-03-21 Tuesday 2016-03-22 Wednesday 2016-03-23 Thursday 2016-03-24 Friday 2016-03-25 Saturday 2016-03-26 Sunday 2016-03-27 Monday 2016-03-28 Tuesday 2016-03-29 Wednesday 2016-03-30 Thursday 2016-03-31
Output for 5.3.0 - 5.4.45
Sunday 2015-11-01 Monday 2015-11-02 Tuesday 2015-11-03 Wednesday 2015-11-04 Thursday 2015-11-05 Friday 2015-11-06 Saturday 2015-11-07 Sunday 2015-11-08 Monday 2015-11-09 Tuesday 2015-11-10 Wednesday 2015-11-11 Thursday 2015-11-12 Friday 2015-11-13 Saturday 2015-11-14 Sunday 2015-11-15 Monday 2015-11-16 Tuesday 2015-11-17 Wednesday 2015-11-18 Thursday 2015-11-19 Friday 2015-11-20 Saturday 2015-11-21 Sunday 2015-11-22 Monday 2015-11-23 Tuesday 2015-11-24 Wednesday 2015-11-25 Thursday 2015-11-26 Friday 2015-11-27 Saturday 2015-11-28 Sunday 2015-11-29 Monday 2015-11-30
Output for 5.2.0 - 5.2.17
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (first day of this month) at position 10 (o): The timezone could not be found in the database' in /in/2h2e2:2 Stack trace: #0 /in/2h2e2(2): DateTime->__construct('first day of th...') #1 {main} thrown in /in/2h2e2 on line 2
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/2h2e2 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/2h2e2 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/2h2e2 on line 2