Skip to content

Instantly share code, notes, and snippets.

@nanashiRei
Created May 3, 2013 17:47
Show Gist options
  • Select an option

  • Save nanashiRei/5511914 to your computer and use it in GitHub Desktop.

Select an option

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