Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$start = "10:00";
$stop = "02:00";
$current_time = time();
$start_time = strtotime($start);
$stop_time = strtotime($stop);
// if end time less then start add one day
if ($stop_time < $start_time) $stop_time += 60 * 60 * 24;
echo "$start_time < $current_time < $stop_time" . PHP_EOL;
if ($current_time < $start_time || $current_time > $stop_time) {
die('Closed');
}
echo 'Open';