3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $datetime = new \DateTime(); $timezone = $datetime->getTimezone(); var_dump($datetime->format('Y-m-d H:i:s')); $datetime->setTimezone(new \DateTimeZone('UTC')); var_dump($datetime->format('Y-m-d H:i:s')); var_dump($timezone->getName());
based on o2Xjv
Output for 5.3.0 - 7.2.0
string(19) "2015-03-17 12:01:50" string(19) "2015-03-17 11:01:50" string(16) "Europe/Amsterdam"
Output for 5.2.0 - 5.2.5, 5.2.7 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 8 string(19) "2015-03-17 12:01:50" string(19) "2015-03-17 11:01:50" string(16) "Europe/Amsterdam"
Output for 5.2.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 8 string(19) "2015-03-17 12:01:50" string(19) "2015-03-17 11:01:50" string(3) "UTC"
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 8 Fatal error: Class 'DateTime' not found in /in/eP8M1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 8 Fatal error: Cannot instantiate non-existent class: datetime in /in/eP8M1 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/eP8M1 on line 8 Fatal error: Cannot instantiate non-existent class: datetime in /in/eP8M1 on line 3