3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime('2013-12-31'); $interval = new DateInterval('P1M'); $end = clone $start; $end->add(new DateInterval('P1Y')); $period = new DatePeriod($start, $interval, $end); foreach ($period as $date) { echo $date->format('F Y')."\n"; }
Output for 5.3.0 - 5.6.23, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
December 2013 January 2014 March 2014 April 2014 May 2014 June 2014 July 2014 August 2014 September 2014 October 2014 November 2014 December 2014
Output for 5.2.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/pvTBJ on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/pvTBJ on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/pvTBJ on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/pvTBJ on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/pvTBJ on line 5
Process exited with code 255.