note 88575 modified in language.oop5.decon by danbrown

From: Date: Thu, 29 Jan 2009 18:40:22 +0000
Subject: note 88575 modified in language.oop5.decon by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149956@lists.php.net to get a copy of this message
You can also capitalize on singleton for the connection as well. Just add the following to your class: <?php class db { //... private static $instance; //... public static function singleton() { if(!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } //... } ?> --was-- You can also capitalize on singleton for the connection as well. Just add the following to your class: class db { ... private static $instance; ... public static function singleton() { if(!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } ... } http://php.net/manual/en/language.oop5.decon.php

« previous php.notes (#149956) next »