3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new \DateTime(); $date->modify((new \DateTime())->format('Y-m-10')); var_dump($date);
Output for 7.3.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000087" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7, 7.1.12, 7.1.18, 7.2.2, 7.3.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000116" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.5, 7.2.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000099" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000111" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000102" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.14, 7.2.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000112" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.20, 7.1.24, 7.2.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000084" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.15, 7.2.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000104" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000096" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.4, 7.1.22, 7.2.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000106" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000109" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000080" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.17, 7.2.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000118" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000085" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000086" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000146" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000081" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000100" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000115" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000194" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000092" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000150" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000122" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000139" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000103" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.2, 7.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000107" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.33, 7.1.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000167" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-10 16:36:09.000088" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-01-10 16:36:09" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/UhT15 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 3 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/UhT15 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 3 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/UhT15 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/UhT15 on line 3 Parse error: parse error in /in/UhT15 on line 3
Process exited with code 255.