3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('now'); $date->add(new DateInterval("P{$days}D")); echo $date; //$date->sub(new DateInterval("P1D"));
based on QuRit
Output for 7.0.0 - 7.2.6
Notice: Undefined variable: days in /in/mb0jg on line 4 Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format (PD) in /in/mb0jg:4 Stack trace: #0 /in/mb0jg(4): DateInterval->__construct('PD') #1 {main} thrown in /in/mb0jg on line 4
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Notice: Undefined variable: days in /in/mb0jg on line 4 Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct(): Unknown or bad format (PD)' in /in/mb0jg:4 Stack trace: #0 /in/mb0jg(4): DateInterval->__construct('PD') #1 {main} thrown in /in/mb0jg on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::add() in /in/mb0jg on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/mb0jg on line 3
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/mb0jg on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/mb0jg on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/mb0jg on line 3