Skip to content

Instantly share code, notes, and snippets.

@okovalov
Created April 8, 2013 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okovalov/5333642 to your computer and use it in GitHub Desktop.
Save okovalov/5333642 to your computer and use it in GitHub Desktop.
<?php
class BdController
{
private $_instance = null ;
public function __construct()
{
$this->_instance = new PDO('mysql:host=127.0.0.1; dbname=pa_tp1','root', '');
}
public function getInstance()
{
return $this->_instance;
}
}
class BdController
{
private statuc $_instance = null ;
private function __construct()
{
$this->_instance = new PDO('mysql:host=127.0.0.1; dbname=pa_tp1','root', '');
}
public static function getInstance()
{
if(is_null(self::$_instance))
{
self::_$instance = new self();
}
return self::$_instance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment