Advertisement
borlabs

Singleton

Sep 19th, 2019
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. class MySingleton
  2. {
  3.     private static $instance;
  4.  
  5.     public static function getInstance()
  6.     {
  7.         if (null === self::$instance) {
  8.             self::$instance = new self;
  9.         }
  10.  
  11.         return self::$instance;
  12.     }
  13.  
  14.     private function __clone()
  15.     {
  16.     }
  17.  
  18.     private function __wakeup()
  19.     {
  20.     }
  21.  
  22.     protected function __construct()
  23.     {
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement