I am developing a web application which revolves around dates.
I need to calculate numbers based around days elasped, for example - pseudo code
$coun
You could create a loop which goes to the next day in the $count_only
array, from the $start_date
and stopping (returning from the function) upon reaching the $end_date
.
function number_of_days_between($start_date, $finish_date, $count_only) {
$count = 0;
$start = new DateTime("@$start_date");
$end = new DateTime("@$finish_date");
$days = new InfiniteIterator(new ArrayIterator($count_only));
foreach ($days as $day) {
$count++;
$start->modify("next $day");
if ($start > $end) {
return $count;
}
}
}