3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expected = new DateTimeImmutable('2015-08-31 01:02:04.456790'); $date = (new DateTimeImmutable('2015-08-31 01:02:03.456789'))->modify('+1000001 microseconds'); $expected_str = $expected->format("YmdHisu"); $date_str = $date->format("YmdHisu"); var_dump("$expected_str <=> $date_str"); // Expected false, but it's actually true var_dump($expected_str > $date_str || $expected_str < $date_str);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
string(45) "20150831010204456790 <=> 20150831010204456790" bool(false)
Output for 7.0.0 - 7.0.33
Warning: DateTimeImmutable::modify(): Failed to parse time string (+1000001 microseconds) at position 5 (0): Unexpected character in /in/YlCDm on line 4 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/YlCDm:7 Stack trace: #0 {main} thrown in /in/YlCDm on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Warning: DateTimeImmutable::modify(): Failed to parse time string (+1000001 microseconds) at position 5 (0): Unexpected character in /in/YlCDm on line 4 Fatal error: Call to a member function format() on boolean in /in/YlCDm on line 7
Process exited with code 255.

preferences:
183.93 ms | 402 KiB | 289 Q