3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime('2013-11-07'); $end = new DateTime('2013-12-31'); $weeks = array(); while ($start < $end) { $weeks[] = $start->format('d-m-Y'); $start->modify('+7 days'); } print_r($weeks);
Output for 5.2.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 07-11-2013 [1] => 14-11-2013 [2] => 21-11-2013 [3] => 28-11-2013 [4] => 05-12-2013 [5] => 12-12-2013 [6] => 19-12-2013 [7] => 26-12-2013 )
Output for 5.2.0 - 5.2.1
Array ( )
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/q6Q9J 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/q6Q9J 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/q6Q9J on line 2