fork(2) download
  1. <?php
  2.  
  3. // your code goes here
  4. $date = new \DateTime('2016-12-01');
  5. $weekly_array[] = $date->format('Y-m-d');
  6.  
  7. for ($i = 0; $i < 16; $i++) {
  8. $date->modify('+1 week');
  9. $weekly_array[] = $date->format('Y-m-d');
  10. }
  11. print_r($weekly_array);
Success #stdin #stdout 0.03s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 2016-12-01
    [1] => 2016-12-08
    [2] => 2016-12-15
    [3] => 2016-12-22
    [4] => 2016-12-29
    [5] => 2017-01-05
    [6] => 2017-01-12
    [7] => 2017-01-19
    [8] => 2017-01-26
    [9] => 2017-02-02
    [10] => 2017-02-09
    [11] => 2017-02-16
    [12] => 2017-02-23
    [13] => 2017-03-02
    [14] => 2017-03-09
    [15] => 2017-03-16
    [16] => 2017-03-23
)