3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $begin = new DateTime( '2012-08-01' ); $end = new DateTime( '2012-08-31' ); $end = $end->modify( '+1 day' ); $interval = new DateInterval('P1D'); $daterange = new DatePeriod($begin, $interval ,$end); foreach($daterange as $date){ echo $date->format("Ymd") . "<br>"; }
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
20120801<br>20120802<br>20120803<br>20120804<br>20120805<br>20120806<br>20120807<br>20120808<br>20120809<br>20120810<br>20120811<br>20120812<br>20120813<br>20120814<br>20120815<br>20120816<br>20120817<br>20120818<br>20120819<br>20120820<br>20120821<br>20120822<br>20120823<br>20120824<br>20120825<br>20120826<br>20120827<br>20120828<br>20120829<br>20120830<br>20120831<br>
Output for 5.2.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/FfkDX on line 6
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/FfkDX on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/FfkDX on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/FfkDX on line 2