3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime; $dt->add('PT2H'); echo $now->format('Y-m-d H:i');
based on lo7lD
Output for 7.0.5 - 7.2.0
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/vDHvT on line 4 Notice: Undefined variable: now in /in/vDHvT on line 5 Fatal error: Uncaught Error: Call to a member function format() on null in /in/vDHvT:5 Stack trace: #0 {main} thrown in /in/vDHvT on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/vDHvT on line 4 Notice: Undefined variable: now in /in/vDHvT on line 5 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/vDHvT:5 Stack trace: #0 {main} thrown in /in/vDHvT on line 5
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/vDHvT on line 4 Notice: Undefined variable: now in /in/vDHvT on line 5 Fatal error: Call to a member function format() on null in /in/vDHvT on line 5
Process exited with code 255.
Output for 5.3.19 - 5.5.35
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/vDHvT on line 4 Notice: Undefined variable: now in /in/vDHvT on line 5 Fatal error: Call to a member function format() on a non-object in /in/vDHvT on line 5
Process exited with code 255.