Skip to content

Instantly share code, notes, and snippets.

@zashme
zashme / splitByMonths.php
Created February 6, 2015 16:47
split date range into months ranges
<?php
function getMonthRanges($start, $end)
{
$timeStart = strtotime($start);
$timeEnd = strtotime($end);
$out = [];
$milestones[] = $timeStart;
$timeEndMonth = strtotime('first day of next month midnight', $timeStart);
while ($timeEndMonth < $timeEnd) {