3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $period = new DatePeriod(new DateTimeImmutable("now"), new DateInterval("P2Y4DT6H8M"), 2); var_dump($period->getStartDate()); var_dump($period->getEndDate()); // segfault? Nice.
based on dH3O6
Output for 7.2.8
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.003530" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.2.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.002951" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.2.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.004168" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.001929" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.10
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.005173" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.7
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.002649" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.012213" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.5
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.012270" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 7.1.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.003885" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 5.6.20 - 5.6.28, 7.0.5 - 7.0.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL
Output for 5.6.5 - 5.6.19, 7.0.0 - 7.0.4
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-08-26 15:16:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Process exited with code 139.
Output for 5.5.0 - 5.6.4
Fatal error: Call to undefined method DatePeriod::getStartDate() in /in/a044v on line 5
Process exited with code 255.
Output for 5.3.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/a044v on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.2.17
Fatal error: Class 'DatePeriod' not found in /in/a044v on line 3
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/a044v on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: dateperiod in /in/a044v on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: dateperiod in /in/a044v on line 3