Strange Characters Displaying with OOP PHP
Just trying out some very simple OOP PHP and some funny characters are being displayed on the page for what seems to be no apparent reason!
I've got two PHP files: A class file which is just PHP and a PHP file which contains HTML and calls the method from the class. Here are the two files I have:
// Property AKA Variable Declaration
public $bookTitle = 'Dracula';
public $bookSlug = '';
public $bookAuthor = '';
public $bookPublisher = '';
public $bookGenreSubject = '';
public $bookRating = '';
public $bookISBN = '';
public $bookPrice = '';
public function __construct()
// $this->bookTitle = $bookTitle;
// Method AKA Function Declaration
public function setBookTitle($bookTitle)
$this->bookTitle = $bookTitle;
public function getBookTitle()
First of all, the title.php page displays this:
<?php include_once("includes/book.class.php") ?>
<?php $title = new Book(); ?>
<title><?php echo $title->getBookTitle(); ?></title>
<h1><?php echo $title->getBookTitle(); ?></h1>
What the bloody hell is going on here? I don't have a clue! All that should be on this page is "Dracula" wrapped in the h1 tags.
And when I go directly to the book.class.php page it always displays this:
Should the class be displaying anything in the browser like that?
Any ideas? Help would be appreciated, thanks.