3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('2014-01-03'); // jan 4 while ($date->format('Y') < 2015){ echo $date->format('Y-m-d') . PHP_EOL; $date->modify('+7 days'); }
Output for 5.2.0 - 7.1.0
2014-01-03 2014-01-10 2014-01-17 2014-01-24 2014-01-31 2014-02-07 2014-02-14 2014-02-21 2014-02-28 2014-03-07 2014-03-14 2014-03-21 2014-03-28 2014-04-04 2014-04-11 2014-04-18 2014-04-25 2014-05-02 2014-05-09 2014-05-16 2014-05-23 2014-05-30 2014-06-06 2014-06-13 2014-06-20 2014-06-27 2014-07-04 2014-07-11 2014-07-18 2014-07-25 2014-08-01 2014-08-08 2014-08-15 2014-08-22 2014-08-29 2014-09-05 2014-09-12 2014-09-19 2014-09-26 2014-10-03 2014-10-10 2014-10-17 2014-10-24 2014-10-31 2014-11-07 2014-11-14 2014-11-21 2014-11-28 2014-12-05 2014-12-12 2014-12-19 2014-12-26
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/cHiNG on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/cHiNG on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/cHiNG on line 3