title: Extend class response in PHP
body: <p>I'm working in a project using mySQL and SQLite DB. My goal is to make the code able to work with both database types. I developed the code for mySQL, using the <code>mysqli</code> class, and now I want to modify it to make it also work with <code>SQLite3</code> objects.</p>
  
  <p><code>SQLite3</code> class implements the same methods as <code>mysqli</code> (at least, those than I use), but sometimes using different names. For example, <code>mysqli::fetch_array()</code> becomes <code>SQLite3::fechArray()</code>. So I'm extending SQLite3 and <code>SQLite3Result</code> classes to implement the methods I need. For example:</p>
  
  <pre><code>class SQLite3ResultEx extends SQLite3Result {
      public function fetch_array() {
          return parent::fetchArray();
      }
  }
  </code></pre>
  
  <p>The problem is that I don't know how to do for extending the response for <code>SQLite3</code> class to get my own <code>SQLite3Response</code> extended class. I mean:</p>
  
  <pre><code>class SQLite3Ex extends SQLite3 {
      public function __construct($filename, $flags = null, $encryption_key = null) {
          return parent::__construct($filename, $flags, $encryption_key);
      }
  
      public function query($query) {
          $res = parent::query($query);
          return $res;
      }
  }
  </code></pre>
  
  <p>Now <code>$res</code> is an <code>SQLite3Result</code> object, but I need it becomes a <code>SQLite3ResultEx</code> object (my own extended class).</p>