PHP检查值是否在数组值内

I am using PHP to check, if start time and end time are within array start time and end time.Then do not show those time stamps. Something like this.

while ($row = mysql_fetch_assoc($getReservationSettings)) {
  if((strtotime($res_date) >=strtotime($row['start_date'])) && $row['recur_end_date'] == '0000-00-00')
    {
       if((17:00 <=$row['start_time']) || 17:00 >=$row['end_time'])
           {
               $myarray[]=date("H:i:s",strtotime($time)+$i*$secs);
           }
     } 
}

What is happening here is that in the first loop if start time is 17:15 and end time is 18:00, it is not showing time within that range. But if in 2nd loop the start time is 13:15 and end time is 15:00, then it will show times within the first loop. Basically I have to validate it through each loop. Please help me on this. Thanks

Make an array of start and end time and then find your desired datetime through in_array php function.

For instance:

<?php 
$time= array("17:00", "18:00", "19:00", "20:00");
if (in_array("18:00", $time))
{
echo "Match found";
}
else
{
echo "Match not found";
}
?>