Created
May 22, 2018 19:35
-
-
Save lgedeon/74c313540be399d322b2bd80add1ab8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Singlton { | |
| // Singlton instance. | |
| static $instance = null; | |
| // Do not create multiples. | |
| private function __construct() { | |
| } | |
| /** | |
| * Return singlton instance. Create if necessary. | |
| * | |
| * @return Singlton | |
| */ | |
| public static function get_instance() { | |
| if ( null === self::$instance ) { | |
| self::$instance = new Singlton(); | |
| } | |
| return self::$instance; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment