Re: Re: hay

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Re: hay
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108766@lists.php.net to get a copy of this message
On Sun, 21 Jul 2002, Richard Lynch wrote: ++>I don't use Classes. How it is possible?:))) I prefer OOP and I use it as much as possible even in PHP ++>> $this=&$GLOBALS["cache"]; ++>I would not expect this to work. ++>PHP is going to finalize and return the class, and you're assignment to ++>$this is meaningless. Oh...you can do everything with this in PHP. $this="text",$this=new B(); and it have a sense - j want to replace an object with another. (but i know that it is not supported by other languages) ++> ++>If you want this to work, you'll have to do more like this: it is some solution... ++><?php ++> $cache = array(); ++> function new_A(); ++> global $cache; ++> ++> if (!isset($cache['A'])){ ++> $cache['A'] = new A(); ++> } ++> return $cache['A']; ++> } ++>?> ++> ++>In other words, keep your cache "external" to the actual object ++>implementation. ++> ++> -- -- pozdr Rad0s Radek Gajewski rgajew@sgh.waw.pl GG:694459 ICQ:110153822 --------------------------------------------------------

« previous php.general (#108766) next »