3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $endDate = new DateTime(); $midnight = clone $endDate; $midnight ->add(new DateInterval('P1D')) ->setTime(0, 0, 0) ; $difference = $midnight->diff($now); var_dump($difference->format('%H:%I:%S'));
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: now in /in/RHUb8 on line 12 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/RHUb8 on line 12 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/RHUb8:14 Stack trace: #0 {main} thrown in /in/RHUb8 on line 14
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: now in /in/RHUb8 on line 12 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/RHUb8 on line 12 Fatal error: Call to a member function format() on boolean in /in/RHUb8 on line 14
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Notice: Undefined variable: now in /in/RHUb8 on line 12 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/RHUb8 on line 12 Fatal error: Call to a member function format() on a non-object in /in/RHUb8 on line 14
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Notice: Undefined variable: now in /in/RHUb8 on line 12 Warning: DateTime::diff() expects parameter 1 to be DateTime, null given in /in/RHUb8 on line 12 Fatal error: Call to a member function format() on a non-object in /in/RHUb8 on line 14
Process exited with code 255.