Skip to content

Instantly share code, notes, and snippets.

@makzan
Last active September 9, 2017 04:31
Show Gist options
  • Select an option

  • Save makzan/5f19b14c85f97f22c93c693fe5e652d7 to your computer and use it in GitHub Desktop.

Select an option

Save makzan/5f19b14c85f97f22c93c693fe5e652d7 to your computer and use it in GitHub Desktop.
<?php
$className = "PHP Basic";
$name = "Thomas";
$day = date('l'); // Full weekday name, e.g. Sunday.
$dayNumber = date('w'); // 0-6 for Sun to Sat.
$isWeekend = false;
$isSunday = false;
if ($dayNumber == 6) {
$isWeekend = true;
}
elseif ($dayNumber == 0) {
$isSunday = true;
}
?>
<!DOCTYPE html>
<title>Sample PHP code</title>
<h1>
Hello <?php echo $name ?>
</h1>
<p>
Hi <?= $name ?>, Welcome to <?= $className ?> class.
It is <strong><?= $day ?></strong> today.
<?php if ($isWeekend): ?>
<mark>Happy Weekend! </mark>
<?php elseif ($isSunday): ?>
<p>Happy Sunday! </p>
<?php endif; ?>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment