/** * Get Instance of PDO Class as Singleton Pattern * * @param array $dsn * * @return object $oPDO */ public static function getPDO($dsn = array()) { // if not set self pdo object property or pdo set as null if (!isset(self::$oPDO) || self::$oPDO !== null) { // set class pdo property with new connection self::$oPDO = new self($dsn); } // return class property object return self::$oPDO; }
/** * Unset The Class Object */ public function __destruct() { self::$oPDO = null; }