3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstAvailableCount = 100; $slice = 'weekly'; $countData = array(); $startDateTime = new DateTime("2015-06-03"); $endDateTime = new DateTime("2016-01-05"); fillCountMapPeriod($startDateTime,$endDateTime,$countData,$firstAvailableCount,$slice); function fillCountMapPeriod( DateTime $startDateTime, DateTime $endDateTime, array $countData, $firstAvailableCount, $slice) { $monthlyInterval = new DateInterval('P1M'); while($startDateTime->add($monthlyInterval) < $endDateTime){ var_dump($startDateTime); } }

preferences:
56.23 ms | 402 KiB | 5 Q