From 03dfca077e03a3143a247ed4437d5507a5b1b019 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 12 Dec 2001 21:15:37 +0000 Subject: [PATCH] "fix" for #11719. clearifyed references and copies on objects. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@64870 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/references.xml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/language/references.xml b/language/references.xml index 786ddc8808..9402e11dbc 100644 --- a/language/references.xml +++ b/language/references.xml @@ -1,5 +1,5 @@ - + References Explained @@ -55,12 +55,14 @@ $foo =& find_var ($bar); - Unless you use the syntax above, the result of - $bar = new fooclass() will not be the same - variable as $this in the constructor, meaning - that if you have used reference to $this in - the constructor, you should use reference assignment, or you get - two different objects. + Not using the & operator causes a copy of + the object. 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 favoured. Mostly you want to have + a single instance to work with, due to performace and memory + consumption issues.