<?php /** * @param Int $days * @return DatePeriod */ function getNumDays($days) { $today = new \DateTime('UTC'); $oneDay = new \DateInterval('P1D'); return new \DatePeriod($today, $oneDay, $days); } foreach(getNumDays(7) as $day){ //Do what ever you want with the DateTime instance //We'll just var_dump() it for now. var_dump($day); }
You have javascript disabled. You will not be able to edit any code.