Created
January 11, 2019 12:20
-
-
Save Andy-set-studio/1f04f252c19cb32fab05f449919cc852 to your computer and use it in GitHub Desktop.
Basic PHP example
This file contains 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 | |
$name = 'Andy'; | |
$age = 31; | |
$favouriteTakeaways = ['Indian', 'Italian', 'Thai']; | |
$favouriteCodeLanguages = ['HTML', 'CSS', 'JavaScript', 'PHP']; | |
?> | |
<!doctype HTML> | |
<html> | |
<head> | |
<title>Basic PHP example</title> | |
<style> | |
body { | |
font-size: 2rem; | |
padding: 2rem; | |
font-family: sans-serif; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Hello, my name is <?= $name; ?></h1> | |
<p>I’m <?= $age ?> years old and my favourite takeaways are:</p> | |
<ul> | |
<?php foreach($favouriteTakeaways as $item): ?> | |
<li><?= $item; ?></li> | |
<?php endforeach; ?> | |
</ul> | |
<p>My favourite code languages are <?= join(', ', $favouriteCodeLanguages); ?></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment