Re: PEAR & Object References

From: Date: Tue, 04 Dec 2001 12:50:57 +0000
Subject: Re: PEAR & Object References
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-571@lists.php.net to get a copy of this message
Vince Veselosky wrote: > > Hi, > I'm just getting started with PEAR development, trying to put together a > small framework I can use to build several applications. Looking at the PEAR > destructor mechanism, I see that it is implemented by adding a reference to > $this to a global array in the object constructor. As I understand it, in > order for this to work properly, this means that a PEAR object should always > be instantiated with the reference syntax and never the copy syntax. In > other words: > > $obj = new MyClass; // Bad > $obj = &new MyClass; // Good > > Otherwise the destructor would not be operating on the same object as the > rest of the program, right? It would be operating on a copy of the object > saved after construction. If this is wrong, can someone draw me a picture? This is correct. - Stig

« previous php.pear.general (#571) next »