Skip to content

Instantly share code, notes, and snippets.

@nanashiRei
Created May 3, 2013 17:47
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 nanashiRei/5511914 to your computer and use it in GitHub Desktop.
Save nanashiRei/5511914 to your computer and use it in GitHub Desktop.
<?php
/**
* singleton pattern class
*/
class Singleton {
public static function getInstance() {
static $instance;
if (static::$instance == null) {
static::$instance == new self();
}
return static::$instance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment