Skip to content

Instantly share code, notes, and snippets.

@hjanuschka
Created May 2, 2017 21:13
Show Gist options
  • Save hjanuschka/cc8170b7a848d6a36aa8fab55b507593 to your computer and use it in GitHub Desktop.
Save hjanuschka/cc8170b7a848d6a36aa8fab55b507593 to your computer and use it in GitHub Desktop.
singelton.php
<?php
class KMMSDKConfig {
protected static $_instance = null;
public $cookie_lifetime = -1;
public static function getInstance()
{
if (null === self::$_instance)
{
self::$_instance = new self;
}
return self::$_instance;
}
protected function __clone() {}
protected function __construct() {}
}
KMMSDKConfig::getInstance()->cookie_lifetime=123;
echo KMMSDKConfig::getInstance()->cookie_lifetime;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment