3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo (new DateTime())->add('1 week')->format('Y-m-d');
based on HZMvH
Output for 7.0.0 - 7.2.0
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/jXFAD on line 3 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/jXFAD:3 Stack trace: #0 {main} thrown in /in/jXFAD on line 3
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/jXFAD on line 3 Fatal error: Call to a member function format() on boolean in /in/jXFAD on line 3
Process exited with code 255.
Output for 5.4.9 - 5.5.35
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/jXFAD on line 3 Fatal error: Call to a member function format() on a non-object in /in/jXFAD on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/jXFAD on line 3
Process exited with code 255.