Office Hours: Mon-Fri 8:00 AM - 5:00 PM, Sat 10:00 AM - 2:00 PM
The office is closed
Code:
<html>
<head>
<title>PHP TEST YAHHH</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<div class="topbar">
<?php
include 'navbar.php';
?>
</div>
<?php
$status = "closed";
echo ("Office Hours: Mon-Fri 8:00 AM - 5:00 PM, Sat 10:00 AM - 2:00 PM");
echo '<br>';
if (date("l") == "Sunday") {
$status = "closed";
}
else if (date("l") == "Saturday") {
if (date("G") >= 10 && date("G") <= 14) {
$status = "open";
}
else {
$status = "closed";
}
}
else {
if (date("G") >= 8 && date("G") <= 17) {
$status = "open";
}
else {
$status = "closed";
}
}
echo ("The office is $status");
echo '<br>';
/* outputs in this format:
Office Hours: Mon-Fri 8:00 AM - 5:00 PM, Sat 10:00 AM - 2:00 PM
The office is open
*/
?>
<div class="codebox">
<h3>Code:</h3>
<?php
highlight_file("ex013.php");
?>
</div>
</body>
</html>