3v4l.org

run code in 200+ PHP versions simultaneously
<?php //Source: https://bugs.php.net/bug.php?id=67634 $date = new DateTimeImmutable('first day of next month midnight - 1 second'); var_dump($date->format('c')); var_dump($date->format('U')); var_dump($date->getTimestamp()); var_dump($date->format('c')); var_dump($date->format('U'));
based on M5Hcu
Output for 7.0.17 - 7.0.33, 7.1.3 - 7.4.0rc2
string(25) "2019-10-31T23:59:59+01:00" string(10) "1572562799" int(1572562799) string(25) "2019-10-31T23:59:59+01:00" string(10) "1572562799"
Output for 5.5.0 - 7.0.16, 7.1.0 - 7.1.2
string(25) "2019-10-31T23:59:59+01:00" string(10) "1572562799" int(1569967199) string(25) "2019-10-01T23:59:59+02:00" string(10) "1569967199"
Output for 5.0.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/ShFpG on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/ShFpG on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/ShFpG on line 4