3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date1 = new \DateTimeImmutable(); $date2 = $date1->modify('+1 day'); var_dump($date1, $date2);
Output for 7.1.0
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2014-07-04 00:45:11.004025" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2014-07-05 00:45:11.004025" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.14 - 7.0.14
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2014-07-04 00:45:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2014-07-05 00:45:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.0 - 5.5.13
object(DateTimeImmutable)#1 (3) { ["date"]=> string(19) "2014-07-04 00:45:11" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(19) "2014-07-05 00:45:11" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/SBkDV on line 2
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SBkDV on line 2 Fatal error: Class 'DateTimeImmutable' not found in /in/SBkDV on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SBkDV on line 2 Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/SBkDV on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/SBkDV on line 2 Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/SBkDV on line 2