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: 
Define *it works fine* :)

Try to:

* compare object hashes returned from both of the methods (does matter when you use object cloning)
* connect to DB using different credentials (e.g. in unit tests)
* disconnect from the DB and reconnect again
* reset the instance of the object (now creating 1000 objects using `new` fills the memory up)
* tell some other developer to create in instance of this class, he will for sure look for `one::getInstance()` method. How do he guesses the behavior of this class?

Singletons are about global state. Looks like here you have global state + some mess.
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`.