/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class SampleClass{ static private $instance = false; function getInstance(){ if (!self::$instance){ self::$instance = new SampleClass(); } return self::$instance; } } //Usage $SampleClassObject = SampleClass::getInstance();
URL: http://simplex.pp.ru/tech/php/singleton
Comments
