title: reconnect to database or use old connection for better perfomance
body: <p>I have multiple classes, and all connecting to the same database I have my database class and user, profile, message class?
  should I use extends or just just global and get the old connection, for speed and performance</p>
  
  <pre><code>class mydb{
  function connect(){
  }
  function query(){
  }
  }
  $mydb = new mydb(connect);
  
  
  
  
      class user extends mydb{
      function get_usr(){
      parent::connect(); // in here I need to connect again, but I still have my connection $mydb
      $value = parent::query(string);
      return $value;
          }
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>class user{
  function get_usr(){
  global $mydb;
  $value = $mydb-&gt;query(string);
  return $value
  }
  
  }
  </code></pre>
  
  <p>now which one is better for better performance .</p>