3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime(); $end = new DateTime('tomorrow'); $timeFrame = round(($end->getTimestamp()-$start->getTimestamp())/2); $endTimeSchedule = new DateTime('+'.$timeFrame.' seconds'); var_dump($endTimeSchedule);
Output for 7.2.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.013880" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.005872" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.005047" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.005340" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.010904" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.006251" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.28, 7.0.14 - 7.0.20
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:00:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30 - 5.4.45, 5.5.14 - 5.6.22, 7.0.0 - 7.0.7
object(DateTime)#3 (3) { ["date"]=> string(26) "2013-01-12 18:30:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#3 (3) { ["date"]=> string(19) "2013-01-12 18:30:58" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::getTimestamp() in /in/m0BvD on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/m0BvD on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/m0BvD on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/m0BvD on line 2