That function won't work, or at least it won't produce the results you said you wanted:
Between 22.00 & 07.00 then the function returns false if its between 07.01 and 21.59 then it returns true...
(I assume that by "between x and y" you mean "between x and y inclusive".) With that code any time beginning with "7:", including "7:01", will cause the if clause to evaluate to false (not what you said, or even what your return strings say).
Try this:
function check_time($x = '22:00', $y = '07:00')
{
$time = date('H:i');
if (($time >= $x) || ($time <= $y)) {
return '22-7 ';
} else {
return '07.01 and 21.59 ';
}
}