Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement