3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new \DateTime('now',new \DateTimeZone('UTC')); var_dump($date);
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-12-17 17:01:25.004042" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.6.28, 7.0.12 - 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-12-17 17:01:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 07:07:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.34, 5.6.20, 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.32 - 5.5.33, 5.6.18 - 5.6.19, 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.31, 5.6.17, 7.0.1 - 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.6.14 - 5.6.16, 7.0.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 02:27:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.45, 5.5.28 - 5.5.30, 5.6.12 - 5.6.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.42 - 5.4.44, 5.5.26 - 5.5.27, 5.6.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.40 - 5.4.41, 5.5.24 - 5.5.25, 5.6.8 - 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.38 - 5.4.39, 5.5.21 - 5.5.23, 5.6.6 - 5.6.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.36 - 5.4.37, 5.5.20, 5.6.4 - 5.6.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.34 - 5.4.35, 5.5.18 - 5.5.19, 5.6.2 - 5.6.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.31 - 5.4.32, 5.5.16, 5.6.0 - 5.6.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 06:13:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.30, 5.5.14 - 5.5.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 19:53:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.28 - 5.4.29, 5.5.12 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:27" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.25 - 5.4.27, 5.5.9 - 5.5.11
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:28" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.28, 5.4.21 - 5.4.24, 5.5.6 - 5.5.8
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:29" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.18 - 5.4.20, 5.5.2 - 5.5.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:30" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.25 - 5.3.27, 5.4.16 - 5.4.17, 5.5.0 - 5.5.1
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:31" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.23 - 5.3.24, 5.4.13 - 5.4.15
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:32" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.20 - 5.3.22, 5.4.11 - 5.4.12
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:33" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.18 - 5.3.19, 5.4.8 - 5.4.10
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:34" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.15 - 5.3.17, 5.4.6 - 5.4.7
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:35" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.13 - 5.3.14, 5.4.3 - 5.4.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:36" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.10 - 5.3.12, 5.4.0 - 5.4.2
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:37" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:26" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.5 - 5.3.9
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:38" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.1 - 5.3.4
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:39" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.0
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-11 19:53:40" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.2.3 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/dr7uJ on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/dr7uJ on line 2 object(DateTime)#1 (0) { }
Output for 5.2.0 - 5.2.2
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> object(DateTime)#1 (0) { }
Output for 5.0.0 - 5.1.6
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/dr7uJ</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/dr7uJ</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/dr7uJ</b> on line <b>2</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/dr7uJ</b> on line <b>2</b><br />