Created
September 5, 2011 11:53
-
-
Save samrayner/1194787 to your computer and use it in GitHub Desktop.
Singleton method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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