3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump((new \DateTime())->format(\DateTime::ISO8601)); $dem = (new \DateTime('2017-03-06T12:10:00+0100')); $created = (new \DateTime('2017-03-06T12:05:00+0000')); var_dump($dem->format('d.m.Y H:i:s')); var_dump($created->format('d.m.Y H:i:s')); var_dump($dem->getTimezone()); var_dump($created->getTimezone()); var_dump($dem->diff($created));
Output for 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.30, 7.4.0 - 7.4.24, 8.0.0 - 8.0.11
string(24) "2017-03-06T13:54:52+0100" string(19) "06.03.2017 12:10:00" string(19) "06.03.2017 12:05:00" object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+01:00" } object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } object(DateInterval)#3 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(0) ["h"]=> int(0) ["i"]=> int(55) ["s"]=> int(0) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(0) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.0.0 - 7.0.20
string(24) "2017-03-06T13:54:52+0100" string(19) "06.03.2017 12:10:00" string(19) "06.03.2017 12:05:00" object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+01:00" } object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } object(DateInterval)#3 (15) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(0) ["h"]=> int(0) ["i"]=> int(55) ["s"]=> int(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(0) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }

preferences:
99.37 ms | 403 KiB | 81 Q