3v4l.org

run code in 150+ 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->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'));
Output for 5.6.19 - 5.6.28, hhvm-3.12.0, 7.0.4 - 7.1.0
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.24 - 5.6.18, 7.0.0 - 7.0.3
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.0

Process exited with code 153.
Output for 5.0.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/5htst on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/5htst on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/5htst on line 2