mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
"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
This commit is contained in:
parent
3747b34a1b
commit
03dfca077e
1 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.20 $ -->
|
||||
<!-- $Revision: 1.21 $ -->
|
||||
<chapter id="language.references">
|
||||
<title>References Explained</title>
|
||||
|
||||
|
@ -55,12 +55,14 @@ $foo =& find_var ($bar);
|
|||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Unless you use the syntax above, the result of
|
||||
<literal>$bar = new fooclass()</literal> will not be the same
|
||||
variable as <literal>$this</literal> in the constructor, meaning
|
||||
that if you have used reference to <literal>$this</literal> in
|
||||
the constructor, you should use reference assignment, or you get
|
||||
two different objects.
|
||||
Not using the <literal>&</literal> operator causes a copy of
|
||||
the object. If you use <literal>$this</literal> in the class
|
||||
it will operate on the current instance of the class. The
|
||||
assignment without <literal>& </literal>will copy the instance
|
||||
(i.e. the object) and <literal>$this</literal> 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.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue