title: PHP - extended __construct
body: <p>I was wondering if you could help me out.. </p>
  
  <p>I have two classes, one extends the other.. Class B will be extended by various different objects and used for common database interactions.. Now I would like class B to handle its connect and disconnects without direction from class A or any external input..</p>
  
  <p>The problem from what I understand is that an extended class won't automatically run its __construct function.. Is there a way around this? </p>
  
  <p>Thanks in advance.. </p>
  
  <pre><code>class a extends b
  {
     public function __construct()
     {
     }   
  
     public function validateStuff()
     {
        $this-&gt;insert_record();
     }
  }
  
  class b
  {
     public function __construct()
     {
        $this-&gt;connect();
     }
  
     protected function connect()
     {
        return true;
     }
  
     public function insert_record()
     {
        return true;
     }
  }
  </code></pre>