How close the connection PDO PHP? : <p>I'm trying to close the connection in my class and I wonder if it is correct.</p>

<p>My public function disconnect(); close connection.</p>

<p>Class Connection:</p>

<pre><code>&lt;?php

class Connection{

   private static $instance;

   public static function getInstance(){

      if (!isset(self::$instance)) {

        try {
            self::$instance = new PDO(DB_DRIVE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
            self::$instance-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            self::$instance-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);

        } catch (PDOException $exception) {
            echo $exception-&gt;getMessage();
        }

      }

      return self::$instance;

   }

   public static function prepare($sql){
      return self::getInstance()-&gt;prepare($sql);
   }

   public static function lastInsertId($sql){
      return self::getInstance()-&gt;lastInsertId($sql);
   }

   public function disconnect(){
      return self::$instance = null;
   }

}
</code></pre>

<p>I use so in my script after execution:</p>

<pre><code>&lt;?php
$connectionDb = new Connection();
$connectionDb-&gt;disconnect();
</code></pre>

<p>Is correct?</p>
