Hi i am creating a reservation system and I have working days(Monday,Tuesday,Wednesday etc) in an array I want to display the next 8 working days from now onwards.

What i am doing is

for($i=0;$i<count($working_days_arr);$i++)
{
    $days_arr=explode(',',$working_days_arr[$i]);
    $j=1;
    $no=1;
    while($j<8)
    {
        if(in_array(date("l", strtotime("+".$no." days")), $days_arr))
        {
            echo date("D d M", strtotime("+".$no." days"))."<br>";
            $j++;
        }
        $no++;
    }
}

And the whole takes hell lot of time to execute i don't know why

$working_days_arr consist

$working_days_arr[0]=Monday,Tuesday,Wedneday etc
$working_days_arr[1]=Saturday,Sunday
$working_days_arr[3]=Friday,Saturday,Sunday

and 5-6 more element in $working_days_arr array

I hope my query is clear

0 Answers