Last active
September 9, 2017 04:31
-
-
Save makzan/5f19b14c85f97f22c93c693fe5e652d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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