<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
display: grid;
place-items: center;
font-family: sans-serif;
height: 100px;
margin: 20px;
}
</style>
<h1>You have read in dark mode </h1>
<?php
function filterBooksByAuthor($books, $author) {
$filteredBooks = array_filter($books, function($book) use ($author) {
return $book['author'] == $author;
});
return $filteredBooks;
}
$books = [
['name' => 'Web', 'author' => 'Philip K. Dick', 'purchaseUrl' => 'http://example.com'],
['name' => 'OOP', 'author' => 'Andy Weir', 'purchaseUrl' => 'http://example.com'],
['name' => 'Database', 'author' => 'Jeffery', 'purchaseUrl' => 'http://example.com']
];
$filteredBooks = filterBooksByAuthor($books, 'Andy Weir');
?>
<!-- Display filtered books -->
<?php foreach ($filteredBooks as $book) : ?>
- = $book['name']; ?> - by = $book['author'] ?>
<?php endforeach; ?>
<?php $sum = function($a, $b) {
return $a + $b;
};
echo "Result of lambda function: " . $sum(3, 4);
?>