Skip to content

Instantly share code, notes, and snippets.

@Andy-set-studio
Created January 11, 2019 12:20
Show Gist options
  • Save Andy-set-studio/1f04f252c19cb32fab05f449919cc852 to your computer and use it in GitHub Desktop.
Save Andy-set-studio/1f04f252c19cb32fab05f449919cc852 to your computer and use it in GitHub Desktop.
Basic PHP example
<?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