Part on Associative Arrays finished
This commit is contained in:
parent
7f7de38781
commit
10571ef7db
2 changed files with 17 additions and 10 deletions
22
index.php
22
index.php
|
|
@ -10,16 +10,24 @@
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
$books = [
|
$books = [
|
||||||
"Do Androids Dream of Electric Sheep",
|
[
|
||||||
"The Langoliers",
|
'name' => 'Do Androids Dream of Electric Sheep',
|
||||||
"Hail Mary"
|
'author' => 'Philip K. Dick',
|
||||||
|
'purchaseUrl' =>'http://example.com'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Projekt Hail Mary',
|
||||||
|
'author' => 'Ady Weir',
|
||||||
|
'purchaseUrl' => 'http://example.com'
|
||||||
|
]
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
<h1>Recommended Book</h1>
|
|
||||||
<ul>
|
|
||||||
<?php foreach($books as $book): ?>
|
<?php foreach($books as $book): ?>
|
||||||
<li><?php echo $book; ?></li>
|
<li>
|
||||||
|
<a href="<?= $book['purchaseUrl']; ?>">
|
||||||
|
<?= $book['name']; ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
body {
|
body {
|
||||||
display: grid;
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue