PHP – The if Statement

The if statement executes some code if one condition is true.

Syntax
if (condition) {
  code to be executed if condition is true;
}

<?php
$d = date("H");

if ($d < "10") {
  echo "Have a good day!";
}
?>
Scroll to Top