Skip to content

Instantly share code, notes, and snippets.

@samrayner
Created September 5, 2011 11:53
Show Gist options
  • Save samrayner/1194787 to your computer and use it in GitHub Desktop.
Save samrayner/1194787 to your computer and use it in GitHub Desktop.
Singleton method
public static $instance;
public static function get_instance() {
$class = get_class(this);
if(!self::$instance)
self::$instance = new $class();
return self::$instance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment