Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. class Singleton
  2. {
  3.     private static $instance = null;
  4.  
  5.     private function __construct() {}
  6.     private function __clone() {}
  7.  
  8.     public static function getInstance() {
  9.         if (is_null(Singleton::$instance)) {
  10.             self::$instance = new static();
  11.         }
  12.         return self::$instance;
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement