public function __construct()
 {
     if (!self::$instance) {
         self::$instance = $this;
         echo "New Instance\n</br>";
         return self::$instance;
     } else {
         echo "Old Instance\n</br>";
         return self::$instance;
     }
 }
 public function __construct()
 {
     if (!self::$instance) {
         // this is the first crucial line.
         self::$instance = $this;
         // this is the second crucial line. $instance is instantiated as the object MySQLManager
         echo "New Instance<br/>";
         return self::$instance;
     } else {
         echo "Old Instance<br/>";
         return self::$instance;
     }
 }
Esempio n. 3
0
 public function connect($host, $db, $user, $password)
 {
     if ($this->driver == 'mysql') {
         $MM = new MySQLManager();
         $MM->setHost($host);
         $MM->setDB($db);
         $MM->setUserName($user);
         $MM->setPassword($password);
         $MM->connect();
     } elseif ($this->driver == 'pgsql') {
         $MM = new PostgreSQLManager();
         $MM->setHost($host);
         $MM->setDB($db);
         $MM->setUserName($user);
         $MM->setPassword($password);
         $MM->connect();
     }
 }