3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTimeImmutable('2014-05'); $date2 = $date->modify('first day of next month midnight - 1 second'); var_dump($date2); var_dump($date2->format('c')); var_dump($date2->format('U')); var_dump($date2->format('c')); var_dump($date2->getTimestamp()); var_dump($date2->format('U')); var_dump($date2->format('c'));
based on mR0q0
Output for 5.6.19 - 5.6.38, 7.0.4 - 7.3.1
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2014-05-31 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(25) "2014-05-31T23:59:59+02:00" string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00" int(1401573599) string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00"
Output for 5.5.14 - 5.6.18, 7.0.0 - 7.0.3
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2014-05-31 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(25) "2014-05-31T23:59:59+02:00" string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00" int(1398981599) string(10) "1398981599" string(25) "2014-05-01T23:59:59+02:00"
Output for hhvm-3.10.1 - 3.22.0
object(DateTimeImmutable)#3 (1) { ["data":"DateTimeImmutable":private]=> object(DateTime)#4 (3) { ["date"]=> string(26) "2014-05-31 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } string(25) "2014-05-31T23:59:59+02:00" string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00" int(1401573599) string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00"
Output for 5.5.0 - 5.5.13
object(DateTimeImmutable)#2 (3) { ["date"]=> string(19) "2014-05-31 23:59:59" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(25) "2014-05-31T23:59:59+02:00" string(10) "1401573599" string(25) "2014-05-31T23:59:59+02:00" int(1398981599) string(10) "1398981599" string(25) "2014-05-01T23:59:59+02:00"
Output for 5.3.17 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/lYHKM on line 3
Process exited with code 255.