Question: All the singleton patterns I have seen use a reference to the object to determine if the object has been instantiated. However, if I am using a singleton to guarantee only one db connection, why not use the db connection resource link to do this? Here is the code I am using. (PS: it works fine). I use the comment to be able to search for my classes easily. 

```
/*one*/

class one
  {
  public static $db;
  private function __construct()
    {
    self::$db=new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
    }
  public static function get()
    {
    if(self::$db==NULL)
      {
      new self();
      }
    return self::$db;
    }
  }

```

Answer: 
Assuming I'm parsing your question correctly, you're asking if it's okay to use the nullity of `$db` to make sure that you only instantiate one; that's a perfectly valid way to do things, and in fact is what I would recommend. PHP `null` is explicitly intended to represent a variable with "no value" - a perfect fit for the uninitialized state of the singleton pattern.

Typically, these things will just be called by an intuitive name, e.g. `SomeAppDbConn`.
```
class one
{
    private static $_selfInstance;
    public $db;
    private function __construct()
    {
    }
    public function getDb()
    {
      if($this->db == null)
      $this->db=new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
      return $this->db;

    }

    public static function getInstance()
    {
      if( !(self::$_selfInstance instanceof self) ) {
        self::$_selfInstance= new self();
      }
      return self::$_selfInstance;
    }
}

```

Access

```
$db = one::getInstance()->getDb();

```