3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set(‘UTC’); $date = new DateTime('2000-12-31'); $date->add(new DateInterval('P1M')); var_dump($date->format('Y-m-d')); $date->add(new DateInterval('P1M')); var_dump($date->format('Y-m-d'));
based on EmW9M
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Use of undefined constant ‘UTC’ - assumed '‘UTC’' in /in/jIlAY on line 2 Notice: date_default_timezone_set(): Timezone ID '‘UTC’' is invalid in /in/jIlAY on line 2 string(10) "2001-01-31" string(10) "2001-03-03"
Output for hhvm-3.10.0 - 3.12.0
Notice: Use of undefined constant ‘UTC’ - assumed '‘UTC’' in /in/jIlAY on line 2 Notice: Timezone ID '‘UTC’' is invalid in /in/jIlAY on line 2 string(10) "2001-01-31" string(10) "2001-03-03"
Output for 5.2.0 - 5.2.17
Notice: Use of undefined constant ‘UTC’ - assumed '‘UTC’' in /in/jIlAY on line 2 Notice: date_default_timezone_set(): Timezone ID '‘UTC’' is invalid in /in/jIlAY on line 2 Fatal error: Call to undefined method DateTime::add() in /in/jIlAY on line 4
Process exited with code 255.
Output for 5.1.2 - 5.1.6
Notice: Use of undefined constant ‘UTC’ - assumed '‘UTC’' in /in/jIlAY on line 2
Process exited with code 139.
Output for 5.1.0 - 5.1.1
Notice: Use of undefined constant ‘UTC’ - assumed '‘UTC’' in /in/jIlAY on line 2 Fatal error: Class 'DateTime' not found in /in/jIlAY on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/jIlAY on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/jIlAY on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/jIlAY on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/jIlAY on line 2