/ Published in: PHP

Not extensively tested but should work just fine!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * Singleton object. Usage: * $objInstance = Singleton::getInstance('ClassName'); */ class Singleton { private function __construct() { } public function getInstance($strClassName) { self::$arrInstances[$strClassNameKey] = new $strClassName; } return self::$arrInstances[$strClassNameKey]; } } ?>
Comments
