3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $interval = new DateInterval('P1D'); $begin = new DateTime(); $end = new DateTime('+5 days'); $period = new DatePeriod($begin, $interval, $end); var_dump($period->getStartDate(), $period->end);
Output for 7.3.0alpha1
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.003398" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.003420" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.6
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.005316" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.005346" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.5
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.004476" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.004497" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.4
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.005857" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.009070" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.3
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.006089" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.006116" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.2
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.010737" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.010776" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.1
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.004931" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.004958" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.0
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.004924" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.004949" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.17
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.004546" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.004576" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.16
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.006157" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.006182" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.15
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.007362" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.007392" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.14
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.007343" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.007370" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.13
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.005944" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.005967" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.12
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.009520" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.011913" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.11
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.009188" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.009232" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.005353" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.005374" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.9
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.007156" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.007185" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.8
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.021522" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.021587" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.005159" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.005178" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.023933" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.023966" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.026842" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.026863" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.4
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.024549" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.024571" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.5 - 5.6.30, 7.1.3
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.2
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.031844" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.031866" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.1
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.006684" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.006700" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTime)#5 (3) { ["date"]=> string(26) "2018-05-30 15:18:55.007125" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#9 (3) { ["date"]=> string(26) "2018-06-04 15:18:55.007146" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Cannot access private property DatePeriod::$end in /in/fnWma:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Cannot access private property DatePeriod::$end in /in/fnWma:9 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.4
Fatal error: Call to undefined method DatePeriod::getStartDate() in /in/fnWma on line 9
Process exited with code 255.