One quick thought: You might want to add the following to your if statement: else { $this->_cache[$key] = new $key; return $this->_cache[$key]; }
Andy > -----Original Message----- > From: Gerard Samuel [mailto:[EMAIL PROTECTED] > Sent: Monday, October 06, 2003 5:36 PM > To: 'PHP List' > Subject: [PHP] Singleton Was: [PHP] OO parent/child relationship > > Gerard Samuel wrote: > > > Andy Crain wrote: > > > >> This all seems like a perfect case for the singleton pattern. See > >> http://www.phppatterns.com/index.php/article/articleview/6/1/1/ and > >> http://www.phppatterns.com/index.php/article/articleview/75/1/1/ > >> Andy > >> > > Im currently trying to wrap the brain around the Singleton Registry > > article. > > Wish me luck :) > > http://www.trini0.org/index.php > This is based on work seen at > http://www.phppatterns.com/index.php/article/articleview/75/1/1/ > Yes yes, I know. It uses $GLOBALS, (OO Sin). Father forgive me.... > From the article, Im getting lost with the reason/meaning/purpose of > the instance() method. > If anyone can clarify it for me, and let me know if my example would > need something like it. > So if you care to critique it, feel free, Ill try not to be hurt ;) > Thanks > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php