3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date2 = new DateTime('2014-05'); $date2->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'));
based on h6f7C
Output for 5.6.19 - 5.6.28, 7.0.4 - 7.2.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.3.0 - 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 5.2.13 - 5.2.17
Warning: DateTime::modify(): Failed to parse time string (first day of next month midnight - 1 second) at position 10 (o): The timezone could not be found in the database in /in/UZS34 on line 5 string(25) "2014-05-01T00:00:00+02:00" string(10) "1398895200" string(25) "2014-05-01T00:00:00+02:00" Fatal error: Call to undefined method DateTime::getTimestamp() in /in/UZS34 on line 10
Process exited with code 255.
Output for 5.2.7 - 5.2.12
string(25) "2014-06-01T23:59:59+02:00" string(10) "1401659999" string(25) "2014-06-01T23:59:59+02:00" Fatal error: Call to undefined method DateTime::getTimestamp() in /in/UZS34 on line 10
Process exited with code 255.
Output for 5.2.0 - 5.2.6
string(25) "2014-06-08T23:59:59+02:00" string(10) "1402264799" string(25) "2014-06-08T23:59:59+02:00" Fatal error: Call to undefined method DateTime::getTimestamp() in /in/UZS34 on line 10
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/UZS34 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/UZS34 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/UZS34 on line 3