Skip to content

Instantly share code, notes, and snippets.

@Nicscott01
Created March 23, 2021 19:59
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 Nicscott01/a87694ce4092380b2054b657a25a997d to your computer and use it in GitHub Desktop.
Save Nicscott01/a87694ce4092380b2054b657a25a997d to your computer and use it in GitHub Desktop.
<?php
class ClassName {
/**
* Instance
*/
public static $instance = null;
/**
* Singleton
*/
public static function get_instance() {
if ( self::$instance == null ) {
self::$instance = new self;
}
return self::$instance;
}
}
//Instantiate
ClassName::get_instance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment