3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = new DateTime('01:01:01.000001'); $timeH = $time->modify('+1 hour'); echo $timeH->format('H:i:s.u') . PHP_EOL; // prints 02:01:01.000001 $timeM = $time->modify('+1 minute'); echo $timeM->format('H:i:s.u') . PHP_EOL; // prints 02:02:01.000001 $timeS = $time->modify('+1 second'); echo $timeS->format('H:i:s.u') . PHP_EOL; // prints 02:02:02.000001 $timeMS = $time->modify('+1 microsecond'); echo $timeMS->format('H:i:S:u') . PHP_EOL; // error
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.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
02:01:01.000001 02:02:01.000001 02:02:02.000001 02:02:th:000002
Output for 7.0.0 - 7.0.20
02:01:01.000001 02:02:01.000001 02:02:02.000001 Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/rUdT7 on line 13 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/rUdT7:14 Stack trace: #0 {main} thrown in /in/rUdT7 on line 14
Process exited with code 255.
Output for 5.6.7 - 5.6.15, 5.6.17 - 5.6.28
02:01:01.000001 02:02:01.000001 02:02:02.000001 Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/rUdT7 on line 13 Fatal error: Call to a member function format() on boolean in /in/rUdT7 on line 14
Process exited with code 255.
Output for 5.6.16
03:01:01.000001 03:02:01.000001 03:02:02.000001 Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/rUdT7 on line 13 Fatal error: Call to a member function format() on boolean in /in/rUdT7 on line 14
Process exited with code 255.
Output for 5.3.2 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35
02:01:01.000001 02:02:01.000001 02:02:02.000001 Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/rUdT7 on line 13 Fatal error: Call to a member function format() on a non-object in /in/rUdT7 on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.1
02:01:01.000001 02:02:01.000001 02:02:02.000001 02:02:th:000001
Output for 5.2.0 - 5.2.17
Fatal error: Call to a member function format() on a non-object in /in/rUdT7 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/rUdT7 on line 2
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/rUdT7 on line 14
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/rUdT7 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/rUdT7 on line 2

preferences:
253.34 ms | 401 KiB | 354 Q