3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $begin = new DateTime( '2007-10-20' ); $end = new DateTime( '2008-03-31' ); $interval = DateInterval::createFromDateString('1 month'); //$interval = new DateInterval('P1M'); $period = new DatePeriod(DateTime::createFromFormat('Y-m-d', $begin->format('Y-m-1')), $interval, $end); foreach ( $period as $dt ) { echo $dt->format( "l Y-m-d H:i:s\n" ); }
based on DYt0B
Output for 5.6.28, 7.0.20 - 7.2.0
Monday 2007-10-01 12:58:26 Thursday 2007-11-01 12:58:26 Saturday 2007-12-01 12:58:26 Tuesday 2008-01-01 12:58:26 Friday 2008-02-01 12:58:26 Saturday 2008-03-01 12:58:26
Output for 7.0.6
Monday 2007-10-01 19:49:21 Thursday 2007-11-01 19:49:21 Saturday 2007-12-01 19:49:21 Tuesday 2008-01-01 19:49:21 Friday 2008-02-01 19:49:21 Saturday 2008-03-01 19:49:21
Output for 7.0.5
Monday 2007-10-01 08:09:27 Thursday 2007-11-01 08:09:27 Saturday 2007-12-01 08:09:27 Tuesday 2008-01-01 08:09:27 Friday 2008-02-01 08:09:27 Saturday 2008-03-01 08:09:27
Output for 7.0.4
Monday 2007-10-01 20:03:20 Thursday 2007-11-01 20:03:20 Saturday 2007-12-01 20:03:20 Tuesday 2008-01-01 20:03:20 Friday 2008-02-01 20:03:20 Saturday 2008-03-01 20:03:20
Output for 7.0.3
Monday 2007-10-01 21:24:06 Thursday 2007-11-01 21:24:06 Saturday 2007-12-01 21:24:06 Tuesday 2008-01-01 21:24:06 Friday 2008-02-01 21:24:06 Saturday 2008-03-01 21:24:06
Output for 7.0.2
Monday 2007-10-01 03:37:54 Thursday 2007-11-01 03:37:54 Saturday 2007-12-01 03:37:54 Tuesday 2008-01-01 03:37:54 Friday 2008-02-01 03:37:54 Saturday 2008-03-01 03:37:54
Output for 7.0.1
Monday 2007-10-01 06:55:12 Thursday 2007-11-01 06:55:12 Saturday 2007-12-01 06:55:12 Tuesday 2008-01-01 06:55:12 Friday 2008-02-01 06:55:12 Saturday 2008-03-01 06:55:12
Output for 7.0.0
Monday 2007-10-01 08:49:53 Thursday 2007-11-01 08:49:53 Saturday 2007-12-01 08:49:53 Tuesday 2008-01-01 08:49:53 Friday 2008-02-01 08:49:53 Saturday 2008-03-01 08:49:53
Output for 5.6.21
Monday 2007-10-01 14:57:28 Thursday 2007-11-01 14:57:28 Saturday 2007-12-01 14:57:28 Tuesday 2008-01-01 14:57:28 Friday 2008-02-01 14:57:28 Saturday 2008-03-01 14:57:28
Output for 5.6.20
Monday 2007-10-01 07:10:33 Thursday 2007-11-01 07:10:33 Saturday 2007-12-01 07:10:33 Tuesday 2008-01-01 07:10:33 Friday 2008-02-01 07:10:33 Saturday 2008-03-01 07:10:33
Output for 5.6.19
Monday 2007-10-01 04:15:52 Thursday 2007-11-01 04:15:52 Saturday 2007-12-01 04:15:52 Tuesday 2008-01-01 04:15:52 Friday 2008-02-01 04:15:52 Saturday 2008-03-01 04:15:52
Output for 5.6.18
Monday 2007-10-01 13:06:02 Thursday 2007-11-01 13:06:02 Saturday 2007-12-01 13:06:02 Tuesday 2008-01-01 13:06:02 Friday 2008-02-01 13:06:02 Saturday 2008-03-01 13:06:02
Output for 5.6.17
Monday 2007-10-01 00:40:58 Thursday 2007-11-01 00:40:58 Saturday 2007-12-01 00:40:58 Tuesday 2008-01-01 00:40:58 Friday 2008-02-01 00:40:58 Saturday 2008-03-01 00:40:58
Output for 5.6.16
Monday 2007-10-01 09:38:58 Thursday 2007-11-01 09:38:58 Saturday 2007-12-01 09:38:58 Tuesday 2008-01-01 09:38:58 Friday 2008-02-01 09:38:58 Saturday 2008-03-01 09:38:58
Output for 5.6.15
Monday 2007-10-01 10:28:33 Thursday 2007-11-01 10:28:33 Saturday 2007-12-01 10:28:33 Tuesday 2008-01-01 10:28:33 Friday 2008-02-01 10:28:33 Saturday 2008-03-01 10:28:33
Output for 5.6.14
Monday 2007-10-01 12:18:46 Thursday 2007-11-01 12:18:46 Saturday 2007-12-01 12:18:46 Tuesday 2008-01-01 12:18:46 Friday 2008-02-01 12:18:46 Saturday 2008-03-01 12:18:46
Output for 5.6.13
Monday 2007-10-01 16:50:00 Thursday 2007-11-01 16:50:00 Saturday 2007-12-01 16:50:00 Tuesday 2008-01-01 16:50:00 Friday 2008-02-01 16:50:00 Saturday 2008-03-01 16:50:00
Output for 5.6.12
Monday 2007-10-01 07:16:43 Thursday 2007-11-01 07:16:43 Saturday 2007-12-01 07:16:43 Tuesday 2008-01-01 07:16:43 Friday 2008-02-01 07:16:43 Saturday 2008-03-01 07:16:43
Output for 5.6.11
Monday 2007-10-01 13:41:21 Thursday 2007-11-01 13:41:21 Saturday 2007-12-01 13:41:21 Tuesday 2008-01-01 13:41:21 Friday 2008-02-01 13:41:21 Saturday 2008-03-01 13:41:21
Output for 5.6.10
Monday 2007-10-01 15:44:58 Thursday 2007-11-01 15:44:58 Saturday 2007-12-01 15:44:58 Tuesday 2008-01-01 15:44:58 Friday 2008-02-01 15:44:58 Saturday 2008-03-01 15:44:58
Output for 5.6.9
Monday 2007-10-01 20:53:33 Thursday 2007-11-01 20:53:33 Saturday 2007-12-01 20:53:33 Tuesday 2008-01-01 20:53:33 Friday 2008-02-01 20:53:33 Saturday 2008-03-01 20:53:33
Output for 5.6.8
Monday 2007-10-01 05:42:43 Thursday 2007-11-01 05:42:43 Saturday 2007-12-01 05:42:43 Tuesday 2008-01-01 05:42:43 Friday 2008-02-01 05:42:43 Saturday 2008-03-01 05:42:43
Output for 5.5.35
Monday 2007-10-01 23:48:42 Thursday 2007-11-01 23:48:42 Saturday 2007-12-01 23:48:42 Tuesday 2008-01-01 23:48:42 Friday 2008-02-01 23:48:42 Saturday 2008-03-01 23:48:42
Output for 5.5.34
Monday 2007-10-01 09:21:57 Thursday 2007-11-01 09:21:57 Saturday 2007-12-01 09:21:57 Tuesday 2008-01-01 09:21:57 Friday 2008-02-01 09:21:57 Saturday 2008-03-01 09:21:57
Output for 5.5.33
Monday 2007-10-01 07:08:21 Thursday 2007-11-01 07:08:21 Saturday 2007-12-01 07:08:21 Tuesday 2008-01-01 07:08:21 Friday 2008-02-01 07:08:21 Saturday 2008-03-01 07:08:21
Output for 5.5.32
Monday 2007-10-01 16:57:01 Thursday 2007-11-01 16:57:01 Saturday 2007-12-01 16:57:01 Tuesday 2008-01-01 16:57:01 Friday 2008-02-01 16:57:01 Saturday 2008-03-01 16:57:01
Output for 5.5.31
Monday 2007-10-01 03:46:21 Thursday 2007-11-01 03:46:21 Saturday 2007-12-01 03:46:21 Tuesday 2008-01-01 03:46:21 Friday 2008-02-01 03:46:21 Saturday 2008-03-01 03:46:21
Output for 5.5.30
Monday 2007-10-01 12:21:31 Thursday 2007-11-01 12:21:31 Saturday 2007-12-01 12:21:31 Tuesday 2008-01-01 12:21:31 Friday 2008-02-01 12:21:31 Saturday 2008-03-01 12:21:31
Output for 5.5.29
Monday 2007-10-01 07:07:58 Thursday 2007-11-01 07:07:58 Saturday 2007-12-01 07:07:58 Tuesday 2008-01-01 07:07:58 Friday 2008-02-01 07:07:58 Saturday 2008-03-01 07:07:58
Output for 5.5.28
Monday 2007-10-01 10:32:28 Thursday 2007-11-01 10:32:28 Saturday 2007-12-01 10:32:28 Tuesday 2008-01-01 10:32:28 Friday 2008-02-01 10:32:28 Saturday 2008-03-01 10:32:28
Output for 5.5.27
Monday 2007-10-01 12:15:12 Thursday 2007-11-01 12:15:12 Saturday 2007-12-01 12:15:12 Tuesday 2008-01-01 12:15:12 Friday 2008-02-01 12:15:12 Saturday 2008-03-01 12:15:12
Output for 5.5.26
Monday 2007-10-01 18:25:50 Thursday 2007-11-01 18:25:50 Saturday 2007-12-01 18:25:50 Tuesday 2008-01-01 18:25:50 Friday 2008-02-01 18:25:50 Saturday 2008-03-01 18:25:50
Output for 5.5.25
Monday 2007-10-01 01:49:17 Thursday 2007-11-01 01:49:17 Saturday 2007-12-01 01:49:17 Tuesday 2008-01-01 01:49:17 Friday 2008-02-01 01:49:17 Saturday 2008-03-01 01:49:17
Output for 5.5.24
Monday 2007-10-01 08:00:30 Thursday 2007-11-01 08:00:30 Saturday 2007-12-01 08:00:30 Tuesday 2008-01-01 08:00:30 Friday 2008-02-01 08:00:30 Saturday 2008-03-01 08:00:30
Output for 5.4.45
Monday 2007-10-01 12:58:28 Thursday 2007-11-01 12:58:28 Saturday 2007-12-01 12:58:28 Tuesday 2008-01-01 12:58:28 Friday 2008-02-01 12:58:28 Saturday 2008-03-01 12:58:28
Output for 5.4.44
Monday 2007-10-01 12:58:29 Thursday 2007-11-01 12:58:29 Saturday 2007-12-01 12:58:29 Tuesday 2008-01-01 12:58:29 Friday 2008-02-01 12:58:29 Saturday 2008-03-01 12:58:29
Output for 5.4.41 - 5.4.43
Monday 2007-10-01 12:58:31 Thursday 2007-11-01 12:58:31 Saturday 2007-12-01 12:58:31 Tuesday 2008-01-01 12:58:31 Friday 2008-02-01 12:58:31 Saturday 2008-03-01 12:58:31
Output for 5.4.40
Monday 2007-10-01 12:58:32 Thursday 2007-11-01 12:58:32 Saturday 2007-12-01 12:58:32 Tuesday 2008-01-01 12:58:32 Friday 2008-02-01 12:58:32 Saturday 2008-03-01 12:58:32
Output for 5.4.37 - 5.4.39
Monday 2007-10-01 12:58:33 Thursday 2007-11-01 12:58:33 Saturday 2007-12-01 12:58:33 Tuesday 2008-01-01 12:58:33 Friday 2008-02-01 12:58:33 Saturday 2008-03-01 12:58:33
Output for 5.4.35 - 5.4.36
Monday 2007-10-01 12:58:34 Thursday 2007-11-01 12:58:34 Saturday 2007-12-01 12:58:34 Tuesday 2008-01-01 12:58:34 Friday 2008-02-01 12:58:34 Saturday 2008-03-01 12:58:34
Output for 5.3.29, 5.4.32 - 5.4.34
Monday 2007-10-01 12:58:35 Thursday 2007-11-01 12:58:35 Saturday 2007-12-01 12:58:35 Tuesday 2008-01-01 12:58:35 Friday 2008-02-01 12:58:35 Saturday 2008-03-01 12:58:35
Output for 5.4.28 - 5.4.31
Monday 2007-10-01 12:58:36 Thursday 2007-11-01 12:58:36 Saturday 2007-12-01 12:58:36 Tuesday 2008-01-01 12:58:36 Friday 2008-02-01 12:58:36 Saturday 2008-03-01 12:58:36
Output for 5.4.25 - 5.4.27
Monday 2007-10-01 12:58:37 Thursday 2007-11-01 12:58:37 Saturday 2007-12-01 12:58:37 Tuesday 2008-01-01 12:58:37 Friday 2008-02-01 12:58:37 Saturday 2008-03-01 12:58:37
Output for 5.3.28, 5.4.21 - 5.4.24
Monday 2007-10-01 12:58:38 Thursday 2007-11-01 12:58:38 Saturday 2007-12-01 12:58:38 Tuesday 2008-01-01 12:58:38 Friday 2008-02-01 12:58:38 Saturday 2008-03-01 12:58:38
Output for 5.3.27, 5.4.18 - 5.4.20
Monday 2007-10-01 12:58:39 Thursday 2007-11-01 12:58:39 Saturday 2007-12-01 12:58:39 Tuesday 2008-01-01 12:58:39 Friday 2008-02-01 12:58:39 Saturday 2008-03-01 12:58:39
Output for 5.3.24 - 5.3.26, 5.4.14 - 5.4.17
Monday 2007-10-01 12:58:40 Thursday 2007-11-01 12:58:40 Saturday 2007-12-01 12:58:40 Tuesday 2008-01-01 12:58:40 Friday 2008-02-01 12:58:40 Saturday 2008-03-01 12:58:40
Output for 5.3.20 - 5.3.23, 5.4.11 - 5.4.13
Monday 2007-10-01 12:58:41 Thursday 2007-11-01 12:58:41 Saturday 2007-12-01 12:58:41 Tuesday 2008-01-01 12:58:41 Friday 2008-02-01 12:58:41 Saturday 2008-03-01 12:58:41
Output for 5.4.10
Monday 2007-10-01 12:58:42 Thursday 2007-11-01 12:58:42 Saturday 2007-12-01 12:58:42 Tuesday 2008-01-01 12:58:42 Friday 2008-02-01 12:58:42 Saturday 2008-03-01 12:58:42