if (!$result) {
throw new Exception("Database Error: " . $connect->error);
}
function getMods ($limit) {
global $connect;
$result = $connect->query("SELECT * FROM `image` ORDER BY `id` DESC LIMIT {$limit}");
if (!$result) {
throw new Exception("Database Error");
}
return resultToArray ($result);
}
function resultToArray ($result) {
$array = array ();
while($row = $result->fetch_assoc()) {
$array[] = $row;
return $array;
}
}
$now = (new \DateTimeImmutable())->format('w');
if ($now === '6'|| $now === '0') {
return true;
} else {
return false;
}
$now = new \DateTimeImmutable();
$startWork = new \DateTimeImmutable("13.06.2020 08:00");
$endWork = new \DateTimeImmutable("14.06.2020 01:00");
if ($startWork <= $now && $now <= $endWork) {
return true;
} else {
return false;
}