3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $expected = new DateTimeImmutable('2015-08-31 01:02:04.456790'); var_dump($expected); $date1 = new DateTimeImmutable('2015-08-31 01:02:03.456789'); $date1 = $date1->modify('1 seconds 1 microseconds'); var_dump($date1); var_dump($expected == $date1); $date2 = new DateTimeImmutable('2015-08-31 01:02:03.456788'); $date2 = $date2->modify('1 seconds 2 microseconds'); var_dump($date2); var_dump($expected == $date2);
Output for 7.2.0 - 7.3.0rc3
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true) object(DateTimeImmutable)#4 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true)
Output for 7.1.0 - 7.1.20
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true) object(DateTimeImmutable)#4 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: DateTimeImmutable::modify(): Failed to parse time string (1 seconds 1 microseconds) at position 10 (1): Unexpected character in /in/c54Dt on line 7 bool(false) bool(false) Warning: DateTimeImmutable::modify(): Failed to parse time string (1 seconds 2 microseconds) at position 10 (2): Unexpected character in /in/c54Dt on line 12 bool(false) bool(false)
Output for hhvm-3.15.4
object(DateTimeImmutable)#1 (1) { ["data":"DateTimeImmutable":private]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-31 01:02:04.456790" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Warning: DateTime::modify(): Failed to parse time string (1 seconds 1 microseconds) at position 10 (1): Unexpected character object(DateTimeImmutable)#5 (1) { ["data":"DateTimeImmutable":private]=> object(DateTime)#6 (3) { ["date"]=> string(26) "2015-08-31 01:02:03.456789" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } bool(false) Warning: DateTime::modify(): Failed to parse time string (1 seconds 2 microseconds) at position 10 (2): Unexpected character object(DateTimeImmutable)#9 (1) { ["data":"DateTimeImmutable":private]=> object(DateTime)#10 (3) { ["date"]=> string(26) "2015-08-31 01:02:03.456788" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } bool(false)