Monthly Archives: February 2016

php how to return all dates between two dates in an array ?

add($interval);

    $period = new DatePeriod(
         new DateTime($start),
         $interval,
         $realEnd
    );

    foreach($period as $date) { 
        $array[] = $date->format('Y-m-d'); 
    }

    return $array;
}

// Call the function
$dates = getDatesFromRange('2015-10-01', '2015-12-05');

// Print the output
print_r($dates);

Array
(
    [0] => 2015-10-01
    [1] => 2015-10-02
    [2] => 2015-10-03
    [3] => 2015-10-04
    [4] => 2015-10-05
    [5] => 2015-10-06
    [6] => 2015-10-07
    [7] => 2015-10-08
    [8] => 2015-10-09
    [9] => 2015-10-10
    [10] => 2015-10-11
    [11] => 2015-10-12
    [12] => 2015-10-13
    [13] => 2015-10-14
    [14] => 2015-10-15
    [15] => 2015-10-16
    [16] => 2015-10-17
    [17] => 2015-10-18
    [18] => 2015-10-19
    [19] => 2015-10-20
    [20] => 2015-10-21
    [21] => 2015-10-22
    [22] => 2015-10-23
    [23] => 2015-10-24
    [24] => 2015-10-25
    [25] => 2015-10-26
    [26] => 2015-10-27
    [27] => 2015-10-28
    [28] => 2015-10-29
    [29] => 2015-10-30
    [30] => 2015-10-31
    [31] => 2015-11-01
    [32] => 2015-11-02
    [33] => 2015-11-03
    [34] => 2015-11-04
    [35] => 2015-11-05
    [36] => 2015-11-06
    [37] => 2015-11-07
    [38] => 2015-11-08
    [39] => 2015-11-09
    [40] => 2015-11-10
    [41] => 2015-11-11
    [42] => 2015-11-12
    [43] => 2015-11-13
    [44] => 2015-11-14
    [45] => 2015-11-15
    [46] => 2015-11-16
    [47] => 2015-11-17
    [48] => 2015-11-18
    [49] => 2015-11-19
    [50] => 2015-11-20
    [51] => 2015-11-21
    [52] => 2015-11-22
    [53] => 2015-11-23
    [54] => 2015-11-24
    [55] => 2015-11-25
    [56] => 2015-11-26
    [57] => 2015-11-27
    [58] => 2015-11-28
    [59] => 2015-11-29
    [60] => 2015-11-30
    [61] => 2015-12-01
    [62] => 2015-12-02
    [63] => 2015-12-03
    [64] => 2015-12-04
    [65] => 2015-12-05
)
Share

How to Detecting Ad Blockers on Your Website using JavaScript ?

ad_blocker_phpmind
This code snippet will display a short message to the user on every page load if ad blockers in place.

It encourages readers to disable ad blocking from your site, which is as easy for them as a couple of clicks.

 
Share