2
I have an array of hours(s) and an array of Schedule(s). When a customer makes an appointment, this time goes to the agenda array. 2 Customers scored the 08hrs, 3 clients the 09hrs ... same as this in the agenda array. Then I want to take the hours when an hour reaches the attendance limit. For example: If I determine that at 9:00 am only 3 calls can be made, in the next hour listing this 9:00 am time cannot appear anymore and this is working perfectly up to that point. But if you repeat two quantities of queries at different times it only takes one random and needed to remove the two with the same amount of queries marked.
Example:
08:00 = 2 scheduled queries;
09:00 = 3 scheduled queries;
but if 10:00 also has 3 queries scheduled he withdraws either the 09hrs or 10hrs and I need to withdraw both if repeat the amount determined by me. Someone could help me?
// horários que são exibidos para os clientes
$hours = array('08:00','08:30','09:00','09:30','10:00','10:30','11:00','11:30','12:00','12:30','13:00','13:30','14:00');
// horários que os clientes marcaram
$schedule = array('08:00','08:00','09:00','09:00','09:00','10:00','10:00','10:00','10:00','11:00','11:00','11:00','11:00','11:00' );
// ao chegar nesse valor de consultas agendada por horário é retirado o horário do array hours
$chooseNumber = 5;
$count = array_count_values( $schedule );
foreach( $count as $number => $value )
{
if( $value > 1 )
{
$schedules[$value] = $number;
if( $value == $chooseNumber )
{
$newHours[$value] = $number;
}
}
}
echo "<pre>";
print_r( $schedules );
echo "</pre>";
echo "<pre>";
print_r( array_diff( $hours, $newHours ) );
echo "</pre>";
sorry for the way I posted it. I’m still not used to the stack way to ask questions. But it might help me in this code?
– Thiago Moreira
how do I put as solved?
– Thiago Moreira