Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
858 B
3
Indexable
Never
<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Demo</title>
</head>

<body>
    
    <?php
        $books = [
            [
                'name' => 'The Langoliers',
                'author' => 'Stephen King',
                'purchaseUrl' => 'http://example.com',
                'year' => 1995
            ],
            [
                'name' => 'Project Hail Mary',
                'author' => 'Andy Weir',
                'purchaseUrl' => 'http://example.com',
                'year' => 1998
            ]
        ];
     ?>

    <ul>
        <?php foreach ($books as $book) : ?>
        <li>
            <a href="<?= $book['purchaseUrl'] ?>">
                <?= $book['name'] ?>
            </a>
            (<?= $book['year'] ?>)
        </li>                
        <?php endforeach ?> 
    </ul>
</body>
</html>