PHP Singleton Design Pattern

The singleton pattern is a design pattern that restricts the Instantiation of a class to one object.

<?php
class Singleton
{
  static $instance = null;

  public static function get()
  {
    if (!self::$instance)
      self::$instance = new Singleton();
    return self::$instance;
  }

  //prevent cloning
  private function __clone() { }

  //preveng unserializing
  private function __wakeup() { }

}

$instance = Singleton::get();
?>