3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $begin = new DateTime( '2007-12-31' ); $end = new DateTime( '2009-12-31 23:59:59' ); $interval = DateInterval::createFromDateString('last thursday of next month'); $period = new DatePeriod($begin, $interval, $end, DatePeriod::EXCLUDE_START_DATE); foreach ( $period as $dt ) echo $dt->format( "l Y-m-d H:i:s\n" );
Output for 5.3.0 - 7.1.0
Thursday 2008-01-31 00:00:00 Thursday 2008-02-28 00:00:00 Thursday 2008-03-27 00:00:00 Thursday 2008-04-24 00:00:00 Thursday 2008-05-29 00:00:00 Thursday 2008-06-26 00:00:00 Thursday 2008-07-31 00:00:00 Thursday 2008-08-28 00:00:00 Thursday 2008-09-25 00:00:00 Thursday 2008-10-30 00:00:00 Thursday 2008-11-27 00:00:00 Thursday 2008-12-25 00:00:00 Thursday 2009-01-29 00:00:00 Thursday 2009-02-26 00:00:00 Thursday 2009-03-26 00:00:00 Thursday 2009-04-30 00:00:00 Thursday 2009-05-28 00:00:00 Thursday 2009-06-25 00:00:00 Thursday 2009-07-30 00:00:00 Thursday 2009-08-27 00:00:00 Thursday 2009-09-24 00:00:00 Thursday 2009-10-29 00:00:00 Thursday 2009-11-26 00:00:00 Thursday 2009-12-31 00:00:00
Output for 5.2.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/gWNgO on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/gWNgO on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/gWNgO on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/gWNgO on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/gWNgO on line 6
Process exited with code 255.