note 92642 deleted from language.references.whatdo by danbrown

From: Date: Mon, 03 Aug 2009 16:55:30 +0000
Subject: note 92642 deleted from language.references.whatdo by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159045@lists.php.net to get a copy of this message
Note Submitter: gwideman ---- Could someone elaborate on what the heck this "Note" is talking about? -------------------- "Note: Not using the & operator causes a copy of the object to be made. If you use $this in the class it will operate on the current instance of the class. The assignment without & will copy the instance (i.e. the object) and $this will operate on the copy, which is not always what is desired. Usually you want to have a single instance to work with, due to performance and memory consumption issues. " -------------------- OK, "use $this in the class" -- is this referring to using $this in a static (ie: class) method? If so, how is there an "instance of the class" to operate on? Then "The assignment without & will copy the instance (i.e. the object) and $this will operate on the copy". Huh? Now we're talking about a method of an object (not a class) right? And under exactly what circumstance will "$this operate on a copy" (of the current object?)? Maybe this is an important note, but I for one can't decode what it's attempting to tell at all.

« previous php.notes (#159045) next »