3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('GMT'); function runTest($a) { print "Before: " . $a->getTimestamp() . "\n"; $b = $a->modify('+1 day'); print "Result after: " . $b->getTimestamp() . "\n"; print "Original after: " . $a->getTimestamp() . "\n"; } print "Immutable:\n"; runTest(new DateTimeImmutable('12/12/2012 12:12:12')); print "\n\nStandard:\n"; runTest(new DateTime('12/12/2012 12:12:12'));
Output for 5.5.24 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Immutable: Before: 1355314332 Result after: 1355400732 Original after: 1355314332 Standard: Before: 1355314332 Result after: 1355400732 Original after: 1355400732
Output for 5.1.0 - 5.4.45
Immutable: Fatal error: Class 'DateTimeImmutable' not found in /in/cPCQT on line 14
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/cPCQT on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/cPCQT on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/cPCQT on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/cPCQT on line 3