3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime(); $interval = new DateInterval('P2D'); $period = new DatePeriod( $start, $interval, 4, DatePeriod::EXCLUDE_START_DATE ); foreach ($period as $nextDateTime) { echo $nextDateTime->format('Y-m-d H:i:s'), PHP_EOL; }
based on CK2lI
Output for 5.6.28, 7.0.20 - 7.2.0
2015-10-18 11:29:13 2015-10-20 11:29:13 2015-10-22 11:29:13 2015-10-24 11:29:13
Output for 7.0.6
2016-05-05 12:13:37 2016-05-07 12:13:37 2016-05-09 12:13:37 2016-05-11 12:13:37
Output for 7.0.5
2016-04-05 00:57:23 2016-04-07 00:57:23 2016-04-09 00:57:23 2016-04-11 00:57:23
Output for 7.0.4
2016-03-12 11:40:18 2016-03-14 11:40:18 2016-03-16 11:40:18 2016-03-18 11:40:18
Output for 7.0.3
2016-03-20 12:23:59 2016-03-22 12:23:59 2016-03-24 12:23:59 2016-03-26 12:23:59
Output for 7.0.2
2016-03-24 18:21:43 2016-03-26 18:21:43 2016-03-28 18:21:43 2016-03-30 18:21:43
Output for 7.0.1
2016-03-25 22:44:56 2016-03-27 22:44:56 2016-03-29 22:44:56 2016-03-31 22:44:56
Output for 7.0.0
2016-03-29 00:14:25 2016-03-31 00:14:25 2016-04-02 00:14:25 2016-04-04 00:14:25
Output for 5.6.21
2016-05-04 07:26:53 2016-05-06 07:26:53 2016-05-08 07:26:53 2016-05-10 07:26:53
Output for 5.6.20
2016-04-11 23:48:26 2016-04-13 23:48:26 2016-04-15 23:48:26 2016-04-17 23:48:26
Output for 5.6.19
2016-03-09 19:42:30 2016-03-11 19:42:30 2016-03-13 19:42:30 2016-03-15 19:42:30
Output for 5.6.18
2016-03-17 04:16:17 2016-03-19 04:16:17 2016-03-21 04:16:17 2016-03-23 04:16:17
Output for 5.6.17
2016-03-21 16:32:45 2016-03-23 16:32:45 2016-03-25 16:32:45 2016-03-27 16:32:45
Output for 5.6.16
2016-03-30 02:12:09 2016-04-01 02:12:09 2016-04-03 02:12:09 2016-04-05 02:12:09
Output for 5.6.15
2016-03-31 03:07:47 2016-04-02 03:07:47 2016-04-04 03:07:47 2016-04-06 03:07:47
Output for 5.6.14
2016-04-04 05:19:07 2016-04-06 05:19:07 2016-04-08 05:19:07 2016-04-10 05:19:07
Output for 5.6.13
2016-04-17 09:18:13 2016-04-19 09:18:13 2016-04-21 09:18:13 2016-04-23 09:18:13
Output for 5.6.12
2016-04-21 23:15:35 2016-04-23 23:15:35 2016-04-25 23:15:35 2016-04-27 23:15:35
Output for 5.6.11
2016-04-25 06:11:43 2016-04-27 06:11:43 2016-04-29 06:11:43 2016-05-01 06:11:43
Output for 5.6.10
2016-04-27 07:58:19 2016-04-29 07:58:19 2016-05-01 07:58:19 2016-05-03 07:58:19
Output for 5.6.9
2016-04-29 13:02:06 2016-05-01 13:02:06 2016-05-03 13:02:06 2016-05-05 13:02:06
Output for 5.6.8
2016-05-01 21:12:29 2016-05-03 21:12:29 2016-05-05 21:12:29 2016-05-07 21:12:29
Output for 5.5.35
2016-05-24 11:13:29 2016-05-26 11:13:29 2016-05-28 11:13:29 2016-05-30 11:13:29
Output for 5.5.34
2016-04-13 02:09:49 2016-04-15 02:09:49 2016-04-17 02:09:49 2016-04-19 02:09:49
Output for 5.5.33
2016-03-10 22:40:28 2016-03-12 22:40:28 2016-03-14 22:40:28 2016-03-16 22:40:28
Output for 5.5.32
2016-03-19 06:20:32 2016-03-21 06:20:32 2016-03-23 06:20:32 2016-03-25 06:20:32
Output for 5.5.31
2016-03-22 19:16:04 2016-03-24 19:16:04 2016-03-26 19:16:04 2016-03-28 19:16:04
Output for 5.5.30
2016-04-03 05:02:23 2016-04-05 05:02:23 2016-04-07 05:02:23 2016-04-09 05:02:23
Output for 5.5.29
2016-04-18 23:26:14 2016-04-20 23:26:14 2016-04-22 23:26:14 2016-04-24 23:26:14
Output for 5.5.28
2016-04-23 02:35:36 2016-04-25 02:35:36 2016-04-27 02:35:36 2016-04-29 02:35:36
Output for 5.5.27
2016-04-24 04:52:34 2016-04-26 04:52:34 2016-04-28 04:52:34 2016-04-30 04:52:34
Output for 5.5.26
2016-04-28 10:30:23 2016-04-30 10:30:23 2016-05-02 10:30:23 2016-05-04 10:30:23
Output for 5.5.25
2016-04-30 16:57:04 2016-05-02 16:57:04 2016-05-04 16:57:04 2016-05-06 16:57:04
Output for 5.5.24
2016-05-26 00:04:35 2016-05-28 00:04:35 2016-05-30 00:04:35 2016-06-01 00:04:35
Output for 5.4.43 - 5.4.45
2015-10-18 11:29:23 2015-10-20 11:29:23 2015-10-22 11:29:23 2015-10-24 11:29:23
Output for 5.4.37 - 5.4.42
2015-10-18 11:29:24 2015-10-20 11:29:24 2015-10-22 11:29:24 2015-10-24 11:29:24
Output for 5.4.29 - 5.4.36
2015-10-18 11:29:25 2015-10-20 11:29:25 2015-10-22 11:29:25 2015-10-24 11:29:25
Output for 5.4.22 - 5.4.28
2015-10-18 11:29:26 2015-10-20 11:29:26 2015-10-22 11:29:26 2015-10-24 11:29:26
Output for 5.4.16 - 5.4.21
2015-10-18 11:29:27 2015-10-20 11:29:27 2015-10-22 11:29:27 2015-10-24 11:29:27
Output for 5.4.10 - 5.4.15
2015-10-18 11:29:28 2015-10-20 11:29:28 2015-10-22 11:29:28 2015-10-24 11:29:28
Output for 5.4.8 - 5.4.9
2015-10-18 11:29:29 2015-10-20 11:29:29 2015-10-22 11:29:29 2015-10-24 11:29:29
Output for 5.4.7
2015-10-29 02:01:19 2015-10-31 02:01:19 2015-11-02 02:01:19 2015-11-04 02:01:19
Output for 5.4.6
2015-10-29 03:29:45 2015-10-31 03:29:45 2015-11-02 03:29:45 2015-11-04 03:29:45
Output for 5.4.5
2015-10-29 05:00:01 2015-10-31 05:00:01 2015-11-02 05:00:01 2015-11-04 05:00:01
Output for 5.4.4
2015-10-29 06:37:15 2015-10-31 06:37:15 2015-11-02 06:37:15 2015-11-04 06:37:15
Output for 5.4.3
2015-10-29 08:18:47 2015-10-31 08:18:47 2015-11-02 08:18:47 2015-11-04 08:18:47
Output for 5.4.2
2015-10-29 10:03:31 2015-10-31 10:03:31 2015-11-02 10:03:31 2015-11-04 10:03:31
Output for 5.3.29
2015-11-02 06:01:38 2015-11-04 06:01:38 2015-11-06 06:01:38 2015-11-08 06:01:38
Output for 5.3.28
2015-11-02 08:10:25 2015-11-04 08:10:25 2015-11-06 08:10:25 2015-11-08 08:10:25
Output for 5.3.27
2015-11-04 07:11:50 2015-11-06 07:11:50 2015-11-08 07:11:50 2015-11-10 07:11:50
Output for 5.3.26
2015-11-04 09:13:03 2015-11-06 09:13:03 2015-11-08 09:13:03 2015-11-10 09:13:03
Output for 5.3.25
2015-11-04 10:43:05 2015-11-06 10:43:05 2015-11-08 10:43:05 2015-11-10 10:43:05
Output for 5.3.24
2015-11-04 11:54:36 2015-11-06 11:54:36 2015-11-08 11:54:36 2015-11-10 11:54:36
Output for 5.3.23
2015-11-04 13:31:01 2015-11-06 13:31:01 2015-11-08 13:31:01 2015-11-10 13:31:01
Output for 5.3.22
2015-11-04 15:02:02 2015-11-06 15:02:02 2015-11-08 15:02:02 2015-11-10 15:02:02
Output for 5.3.21
2015-11-04 16:02:12 2015-11-06 16:02:12 2015-11-08 16:02:12 2015-11-10 16:02:12
Output for 5.3.20
2015-11-04 17:02:33 2015-11-06 17:02:33 2015-11-08 17:02:33 2015-11-10 17:02:33
Output for 5.3.19
2015-11-04 18:27:49 2015-11-06 18:27:49 2015-11-08 18:27:49 2015-11-10 18:27:49
Output for 5.3.18
2015-11-04 18:34:27 2015-11-06 18:34:27 2015-11-08 18:34:27 2015-11-10 18:34:27