$schedToday = '11am-5pm';
isBusinessOpen($daytoday]);
function isBusinessOpen($time_str){
//Get the position of the dash so that you could get the start and closing time
$cut = strpos($time_str, '-');
//use substring to get the first windows time and use strtotime to convert it to
$opening_time = strtotime(substr($time_str, 0, $cut));
//same as the first but this time you need to get the closing time
$closing_time = strtotime(substr($time_str, $cut + 1));
//now check ifthe closing time is morning so that you could adjust the date since most likely an AM close time is dated tomorrow
if(strpos(strtolower(substr($time_str, $cut + 1)), 'am')){
$closing_time = strtotime(date('m/d/y') . ' ' . substr($time_str, $cut + 1) . ' + 1 day');
$opening_time = strtotime(date('m/d/y') . ' ' . substr($time_str, 0, $cut));
}
//to get the current time. take note that this will base on your server time
$now = strtotime('now');
// now simply check if the current time is > than opening time and less than the closing time
return $now >= $opening_time && $now < $closing_time;
}