PEAR & Object References

From: Date: Tue, 27 Nov 2001 07:01:55 +0000
Subject: PEAR & Object References
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-541@lists.php.net to get a copy of this message
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? Thanks in Advance, Vince V.

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