Yes, that's quite a long script, but it's just a combination of the code we've seen so far, with the new twist that constructors are being used. Note the __construct() function in the dog class, which takes one variable - that is our constructor. Whenever we instantiate a poodle object, PHP calls the relevant constructor.
There are three important things to note:
The constructor is not in the poodle class - it is in the dog class. What happens is that PHP looks for a constructor in poodle, and if it fails to find one there, it goes to its parent class (where poodle inherited from), and if it fails to find one there, it goes up again, and up again, ad infinitum, until it reaches the top of the class structure. As the dog class is the top of our class structure, PHP does not have far to go.
PHP only ever calls one constructor for you. If you have several constructors in a class structure, PHP will only call the first one it finds.
The __construct() function is marked public - that's not by accident. If you don't mark the constructor as public you can only instantiate objects of a class from within the class itself, which is almost an oxymoron. If you make this private, you need to use a static function call - quite messy, but used in some places.