3v4l.org

run code in 200+ 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
based on vGsdM
Output for 7.1.0 - 7.3.0beta1
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.20
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/NfEEh on line 14 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/NfEEh:15 Stack trace: #0 {main} thrown in /in/NfEEh on line 15
Process exited with code 255.
Output for 5.6.0 - 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/NfEEh on line 14 Fatal error: Call to a member function format() on boolean in /in/NfEEh on line 15
Process exited with code 255.