3v4l.org

run code in 300+ PHP versions simultaneously
<?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'));

preferences:
38.53 ms | 402 KiB | 5 Q