Using OOP there comes a need to call the constructor of a parent class, this is not hard to do
class TestParent { public function __construct() { var_dump('blah'); } } class TestChild extends TestParent { public function __construct() { parent::__construct(); } } $a = new TestChild(); //Output will be: string 'blah' (length=4) |
In PHP4 this would have looked like (this still works in PHP5)
class TestParent { public function TestParent() { var_dump('blah'); } } class TestChild extends TestParent { public function TestChild() { parent::TestParent(); } } $a = new TestChild(); //Output will be: string 'blah' (length=4) |