This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Conditional Statements

PHP - The if...elseif...else Statement

The hour (of the server) is 20:32, and will give the following message:
Have a good night!

<?php
$t = date("H:i");
echo "<p>The hour (of the server) is " . $t; 
echo ", and will give the following message:<br>";

if ($t < "10") {
  echo "Have a good morning!</p>";
} elseif ($t < "20") {
  echo "Have a good day!</p>";
} else {
  echo "Have a good night!</p>";
}
?>