title: How to disabled time slots according to service time?
body: <p>All i want, to calculate time-slots-list according to my <strong>business-hours</strong> and <strong>block</strong> or <strong>disable</strong> those time-slots which booked by appointments.</p>
  
  <p>I have done these things with my problem, stuck on last task, mention below.<br></p>
  
  <pre><code>My Service Duration = 60min.
  My Today Busines Hours:
  start time - 10:00 AM
  end time - 3:00 PM
  </code></pre>
  
  <p>I have generated 15min time slot-list according to my today business hours:</p>
  
  <pre><code>$start = strtotime('10:00 AM');
  $end = strtotime('3:00 PM');
  for( $i = $start; $i &lt;= $end; $i += (60*15)) 
  {
      $slotlist[] = date('g:iA', $i);
  }
  
  //output
  10:00AM
  10:15AM
  10:30AM
  10:45AM
  11:00AM
  11:15AM
  11:30AM
  11:45AM
  12:00PM
  12:15PM
  12:30PM
  12:45PM
  1:00PM
  1:15PM
  1:30PM
  1:45PM
  2:00PM
  2:15PM
  2:30PM
  2:45PM
  3:00PM
  </code></pre>
  
  <p><strong>now i have booked 3 appointments</strong><br></p>
  
  <p>Appointments  |   start-time to  end-times</p>
  
  <hr>
  
  <p>Appointment-1 : 10:00AM to 11:00AM (according to my service duration 60min)<br>
  Appointment-2 : 11:15AM to 12:15PM<br>
  Appointment-3 : 1:00PM to 2:00PM<br></p>
  
  <hr>
  
  <pre><code>//array of all appointment start_time
  $appointment_start_time = array('10:00AM','11:15AM','1:00PM');
  </code></pre>
  
  <p><strong>Now disable those time-slots which are already booked in appointments</strong></p>
  
  <pre><code>foreach($slotlist as $single)
  {
      if(in_array($single, $appointment_start_time))
      {
          echo "&lt;input name=start_time type='radio' disabled  value='$single' /&gt;".$single; echo "&lt;br&gt;";
  
          $time = $single;                                                
          $event_length = 60-15;          // 60 is time duration                              
          $timestamp = strtotime("$time");                                
          $endtime = strtotime("+$event_length minutes", $timestamp);     
          $next_time = date('g:i A', $endtime);                       
  
          //calculate between slots (start-end time)
          $start = strtotime($single);
          $end = strtotime($next_time);
              for( $i = $start; $i &lt;= $end; $i += (60*15)) 
              {
                  $list2[] = date('g:iA', $i);
              }
      }
      else
      {   
          if(in_array($single, $list2))
          {
              echo "&lt;input name=start_time type='radio' disabled  value='$single' /&gt;".$single; echo "&lt;br&gt;";
          }
          else
          {   
  
              echo "&lt;input name=start_time type='radio'  value='$single' /&gt;".$single; echo "&lt;br&gt;";
          }
      }
  
  }
  
  //output
  10:00AM -disabled
  10:15AM -disabled
  10:30AM -disabled
  10:45AM -disabled
  11:00AM
  11:15AM -disabled
  11:30AM -disabled
  11:45AM -disabled
  12:00PM -disabled
  12:15PM
  12:30PM
  12:45PM
  1:00PM -disabled
  1:15PM -disabled
  1:30PM -disabled
  1:45PM -disabled
  2:00PM
  2:15PM
  2:30PM
  2:45PM
  3:00PM
  </code></pre>
  
  <p>Now last task to do,
  how to remove those time slot which are not qualify service duration time like as:</p>
  
  <pre><code>11:00AM (single slot b/w 2 appointment, cover only 15min)
  
  12:15PM -
  12:30PM -(3 slot b/w 2 appointment, cover only 45min)
  12:45PM -
  </code></pre>