public static function timeInRange($start, $expiry)
{
// Check empty
if (empty($start) && empty($expiry)) {
return false;
}
// Get now
$now = time();
// Default
$start = empty($start) ? $now : $start;
$expiry = empty($expiry) ? $now : $expiry;
// Stability
if (!is_numeric($start) || !is_numeric($expiry)) {
return false;
}
// Wrong range
if ($start > $expiry) {
return false;
}
return $start <= $now && $expiry >= $now;
}