3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('UTC'); $date = new \DateTime('2014-01-30'); $date->add(new \DateInterval('P1M')); echo $date->format('Y-m-d') . PHP_EOL; // echoes 2014-03-02 $date = new \DateTime('2014-01-31'); $date->add(new \DateInterval('P1M')); echo $date->format('Y-m-d') . PHP_EOL; // echoes 2014-03-03
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
2014-03-02 2014-03-03
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Call to undefined method DateTime::add() in /in/ZeVol on line 6
Process exited with code 255.
Output for 5.1.1 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Class 'DateTime' not found in /in/ZeVol on line 5
Process exited with code 255.
Output for 5.1.0
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: fatal flex scanner internal error--end of buffer missed in /in/ZeVol on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Call to undefined function date_default_timezone_set() in /in/ZeVol on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZeVol on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZeVol on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ZeVol on line 10 Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZeVol on line 3