Created
December 11, 2013 01:02
-
-
Save patrioticcow/7903359 to your computer and use it in GitHub Desktop.
Singleton Pattern
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
class Logger { | |
static function getInstance() | |
{ | |
if (self::$instance == NULL) { | |
self::$instance = new Logger(); | |
} | |
return self::$instance; | |
} | |
private function __construct() | |
{ | |
} | |
private function __clone() | |
{ | |
} | |
function Log($str) | |
{ | |
// Take care of logging | |
} | |
static private $instance = NULL; | |
} | |
Logger::getInstance()->Log("Checkpoint"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment