<?php
class DB {
protected static $db;
public static function run()
{
try
{
global $config;
self::$db = new PDO('mysql:dbname=' . $config['db']['name'] . ';host=' . $config['db']['host'], $config['db']['user'], $config['db']['pass']);
}
catch (PDOException $error)
{
exit ($error->getMessage());
}
return self::$db;
}
final public function __destruct() {
self::$db = null;
}
}