PHP - Programming Language
This course covers the basics of programming in PHP. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Constructors

Lesson 30
Author : Mike Dane
Last Updated : November, 2017


Code

Copyclass Book{
     var $title;
     public $author;

     function __construct($title, $author){
          $this->title = $title;
          $this->author = $author;
     }
};

$book1 = new Book("Harry Potter", "JK Rowling");
// $book1->title = "Half-Blood Prince";

echo $book1->title."<br>";