Re: Singleton Pattern?

From: Date: Thu, 18 Mar 2004 22:42:35 +0000
Subject: Re: Singleton Pattern?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26569@lists.php.net to get a copy of this message
Quoting Paul M Jones <pmjones@ciaweb.net>:
     function &singleton()
     {
         static $obj;
         if (! isset($obj)) {
             echo "create ";
             $obj =& new test();
This line is what's killing you. Lose the &, and it'll work. The reason is something to do with references and static variables that I've suppressed. -chuck -- "Regard my poor demoralized mule!" - Juan Valdez

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