Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
The if...elseif...else statement
SUBMITTED BY:
henry1874w
DATE:
June 12, 2017, 4:10 p.m.
FORMAT:
Text only
SIZE:
334 Bytes
Raw
Download
Tweet
HITS:
310
Go to comments
Report
<!DOCTYPE html>
<html>
<body>
<?php
$t = date("H");
echo "<p>The hour (of the server) is " . $t;
echo ", and will give the following message:</p>";
if ($t < "10") {
echo "Have a good morning!";
} elseif ($t < "20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}
?>
</body>
</html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus