<?php
$book = [
"name" => "Harry Potter and the Goblet of Fire",
"author" => "J. K. Rowling",
"year" => 2000,
"genre" => "Fantasy Fiction",
"bestseller" => true
];
// Simpan file `book.php`.
<?php
require_once('book.php');
// Akses data buku.
$bookName = $book['name'];
$bookAuthor = $book['author'];
$bookYear = $book['year'];
$bookGenre = $book['genre'];
$bookBestseller = $book['bestseller'];
// Tampilkan data buku.
echo "Nama buku: $bookName" . "\n";
echo "Penulis: $bookAuthor" . "\n";
echo "Tahun terbit: $bookYear" . "\n";
echo "Genre: $bookGenre" . "\n";
echo "Bestseller: $bookBestseller" . "\n";
?>