3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set(‘America/Sao_Paulo’); $date = new DateTime('2014-01-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 HcVWZ
Output for 7.1.0
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: A non-numeric value encountered in /in/pWYaU on line 2 Warning: A non-numeric value encountered in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: date_default_timezone_set(): Timezone ID 'NAN' is invalid in /in/pWYaU on line 2 string(10) "2014-03-03" string(10) "2014-04-03"
Output for 7.0.0 - 7.0.14
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: date_default_timezone_set(): Timezone ID 'NAN' is invalid in /in/pWYaU on line 2 string(10) "2014-03-03" string(10) "2014-04-03"
Output for hhvm-3.12.0
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: Timezone ID '' is invalid in /in/pWYaU on line 2 string(10) "2014-03-03" string(10) "2014-04-03"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.6.28
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: date_default_timezone_set(): Timezone ID '' is invalid in /in/pWYaU on line 2 string(10) "2014-03-03" string(10) "2014-04-03"
Output for 5.2.0 - 5.2.17
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: date_default_timezone_set(): Timezone ID '' is invalid in /in/pWYaU on line 2 Fatal error: Call to undefined method DateTime::add() in /in/pWYaU on line 4
Process exited with code 255.
Output for 5.1.2 - 5.1.6
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Notice: date_default_timezone_set(): Timezone ID '' is invalid in /in/pWYaU on line 2 Fatal error: Class 'DateTime' not found in /in/pWYaU on line 3
Process exited with code 255.
Output for 5.1.0 - 5.1.1
Notice: Use of undefined constant ‘America - assumed '‘America' in /in/pWYaU on line 2 Notice: Use of undefined constant Sao_Paulo’ - assumed 'Sao_Paulo’' in /in/pWYaU on line 2 Warning: Division by zero in /in/pWYaU on line 2 Fatal error: Class 'DateTime' not found in /in/pWYaU 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/pWYaU 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/pWYaU 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/pWYaU 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/pWYaU on line 2