Re: Re: Singleton Pattern?

From: Date: Fri, 19 Mar 2004 08:45:02 +0000
Subject: Re: Re: Singleton Pattern?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26585@lists.php.net to get a copy of this message
Hi! > > I've found the corresponding bug report: > > http://bugs.php.net/bug.php?id=12454 I run into the same problem some months ago using PHP 4.1.2. But I figured out a workaround: function &getInstance() { static $db = array(); if (empty($db)) { $db[0] =& new FS_DB(); } return $db[0]; } If put the reference into a static array, it works. Try it. Markus

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