3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $departureTime = '2015-12-08 12:55'; $departureTimeZone = 'America/New_York'; $arrivalTime = '2015-12-08 17:44'; $arrivalTimeZone = 'America/Santo_Domingo'; // The following datetimes are added to the new segment $segmentDepartureTime = new \DateTime($departureTime, $departureTimeZone); echo "segmentDepartureTime: " . $segmentDepartureTime->format('Y-m-d H:i') . "\n"; $segmentArrivalTime = new \DateTime($arrivalTime, $arrivalTimeZone); echo "segmentArrivalTime: " . $segmentArrivalTime->format('Y-m-d H:i') . "\n";
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given in /in/TmNQC:9 Stack trace: #0 /in/TmNQC(9): DateTime->__construct('2015-12-08 12:5...', 'America/New_Yor...') #1 {main} thrown in /in/TmNQC on line 9
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 2 to be DateTimeZone, string given' in /in/TmNQC:9 Stack trace: #0 /in/TmNQC(9): DateTime->__construct('2015-12-08 12:5...', 'America/New_Yor...') #1 {main} thrown in /in/TmNQC on line 9
Process exited with code 255.