Re: do pear packages create their own seperate DB connections?

From: Date: Wed, 23 Apr 2003 01:10:19 +0000
Subject: Re: do pear packages create their own seperate DB connections?
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15360@lists.php.net to get a copy of this message
I generally use: function &getInstance() { static $instance; if (!isset($instance)) {
      $instance = new Class(); // NOT by reference
} return $instance; }
be wary of doing this where performance is an issue - dataobjects used something like this to store options early on. - - PEAR::getStaticProperty() ** note this could be used for singletons as well. however after alot of profiling I realized that it was slowing down the whole application. if you have to get the singleton of a class often it's better to stick with $GLOBALS etc. Regards Alan -- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#15360) next »