$pageTitle = $page->getTitle(); echo "The title of this page is: " . $pageTitle;
class Book { private $title; public function __construct($title) { $this->title = $title; } public function getTitle() { return $this->title; } } $book = new Book("To Kill a Mockingbird"); $bookTitle = $book->getTitle(); echo "The title of this book is: " . $bookTitle;In this example, we create a Book class with a private property called $title. We then define an __construct method that takes a title parameter and sets the $title property. Finally, we define a getTitle method that returns the $title property. We then create a new Book object with the title "To Kill a Mockingbird" and store it in a variable called $book. We retrieve the book's title using the getTitle method and store it in a variable called $bookTitle. We then use echo to display the book's title on the page. The package library used in these examples is likely the standard PHP library, which contains many built-in methods and classes like getTitle.