[Solved] Get total number of each day between two date in php


Try;

define('ONE_WEEK', 604800); // 7 * 24 * 60 * 60

function number_of_days($day, $start, $end)
{
    $w = array(date('w', $start), date('w', $end));

    return floor( ( $end - $start ) / ONE_WEEK ) + ( $w[0] > $w[1] ? $w[0] <= $day || $day <= $w[1] : $w[0] <= $day && $day <= $w[1] );
}

//$start = $end = time();

echo number_of_days(0, $start, $end); // SUNDAY
echo number_of_days(1, $start, $end); // MONDAY
echo number_of_days(2, $start, $end); // TUESDAY
echo number_of_days(3, $start, $end); // WEDNESDAY
echo number_of_days(4, $start, $end); // THURSDAY
echo number_of_days(5, $start, $end); // FRIDAY
echo number_of_days(6, $start, $end); // SATURDAY
?>

0

solved Get total number of each day between two date in php