Skip to content

Instantly share code, notes, and snippets.

@leviwheatcroft
Created May 30, 2014 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leviwheatcroft/c18f203a454166c8ad56 to your computer and use it in GitHub Desktop.
Save leviwheatcroft/c18f203a454166c8ad56 to your computer and use it in GitHub Desktop.
just another singleton pattern
<?php
class Singleton
{
protected static $instance = null;
protected function __construct()
{
}
protected function __clone()
{
}
protected function __wakeup()
{
}
public static function getInstance()
{
if (!isset(static::$instance)) {
static::$instance = new static;
}
return static::$instance;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment