61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
echo "<!DOCTYPE html>\n";
|
|
echo "<html lang=\"en\">\n";
|
|
echo "<!-- This is a simple PHP template -->\n";
|
|
// This section could also use <?= syntax, but for example's sake, will not.
|
|
?>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= ucfirst(basename(__FILE__, '.php')) ?></title>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<meta name="description" content="">
|
|
|
|
<meta property="og:title" content="">
|
|
<meta property="og:type" content="">
|
|
<meta property="og:url" content="">
|
|
<meta property="og:image" content="">
|
|
|
|
<link rel="icon" href="/favicon.ico" sizes="any">
|
|
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
<link rel="apple-touch-icon" href="icon.png">
|
|
|
|
<link rel="manifest" href="site.webmanifest">
|
|
<meta name="theme-color" content="#fafafa">
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Hello world!</h1>
|
|
|
|
<p>This page was rendered on <?= date("Y-m-d") ?></p>
|
|
|
|
<pre><?php
|
|
$pairs = [
|
|
"hello" => "world!",
|
|
"how are" => "you?",
|
|
"i like the number" => 3
|
|
];
|
|
|
|
// Iterate over key-value pairs
|
|
foreach ($pairs as $k => $v) {
|
|
echo "($k, $v) ";
|
|
}
|
|
echo "\n\n";
|
|
|
|
// Iterate over keys
|
|
foreach (array_keys($pairs) as $key) {
|
|
echo "$key: $pairs[$key]\n";
|
|
}
|
|
echo "\n";
|
|
|
|
// Iterate over values
|
|
foreach ($pairs as $value) {
|
|
echo "values = $value\n";
|
|
}
|
|
?>
|
|
</pre>
|
|
</body>
|
|
|
|
</html>
|