3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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
02:01:01.000001 02:02:01.000001 02:02:02.000001 02:02:th:000002
Output for 7.0.0 - 7.0.14
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.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.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