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') . '<br>'; // prints 02:01:01.000001 $timeM = $time->modify('+1 minute'); echo $timeM->format('H:i:s.u') . '<br>'; // prints 02:02:01.000001 $timeS = $time->modify('+1 second'); echo $timeS->format('H:i:s.u') . '<br>'; // prints 02:02:02.000001 $timeMS = $time->modify('+1 microsecond'); echo $timeMS->format('H:i:S:u') . '<br>'; // error
Output for 7.1.0
02:01:01.000001<br>02:02:01.000001<br>02:02:02.000001<br>02:02:th:000002<br>
Output for 7.0.0 - 7.0.14
02:01:01.000001<br>02:02:01.000001<br>02:02:02.000001<br> Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/otCLg on line 13 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/otCLg:14 Stack trace: #0 {main} thrown in /in/otCLg 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<br>02:02:01.000001<br>02:02:02.000001<br> Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/otCLg on line 13 Fatal error: Call to a member function format() on boolean in /in/otCLg on line 14
Process exited with code 255.
Output for 5.6.16
03:01:01.000001<br>03:02:01.000001<br>03:02:02.000001<br> Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/otCLg on line 13 Fatal error: Call to a member function format() on boolean in /in/otCLg on line 14
Process exited with code 255.
Output for 5.3.7 - 5.5.35
02:01:01.000001<br>02:02:01.000001<br>02:02:02.000001<br> Warning: DateTime::modify(): Failed to parse time string (+1 microsecond) at position 9 (e): Double timezone specification in /in/otCLg on line 13 Fatal error: Call to a member function format() on a non-object in /in/otCLg on line 14
Process exited with code 255.