@ 2014-07-03T22:33:43Z <?php
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'));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.12 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Immutable:
Before: 1355310732
Result after: 1355397132
Original after: 1355310732
Standard:
Before: 1355310732
Result after: 1355397132
Original after: 1355397132
Output for 7.3.32 - 7.3.33 , 8.0.13 Immutable:
Before: 1355314332
Result after: 1355400732
Original after: 1355314332
Standard:
Before: 1355314332
Result after: 1355400732
Original after: 1355400732
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 Immutable:
Fatal error: Class 'DateTimeImmutable' not found in /in/lNPjb on line 12
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Immutable:
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/lNPjb on line 12
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Immutable:
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/lNPjb on line 12
preferences:dark mode live preview
208.79 ms | 401 KiB | 341 Q