Re: do pear packages create their own seperate DB connections?
| From: | Wolfram Kriesing | Date: | Wed, 23 Apr 2003 08:01:33 +0000 |
| Subject: | Re: do pear packages create their own seperate DB connections? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15365@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
you mean 'static' is slow? how can that be? -- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/authI generally use: function &getInstance() { static $instance; if (!isset($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.$instance = new Class(); // NOT by reference} return $instance; }