andre Fri Mar 9 14:29:02 2001 EDT
Modified files:
/phpdoc/en/language oop.xml
Log:
fix xml
Index: phpdoc/en/language/oop.xml
diff -u phpdoc/en/language/oop.xml:1.8 phpdoc/en/language/oop.xml:1.9
--- phpdoc/en/language/oop.xml:1.8 Fri Mar 9 13:45:32 2001
+++ phpdoc/en/language/oop.xml Fri Mar 9 14:29:02 2001
@@ -209,7 +209,7 @@
function foo($name) {
// create a reference inside the global array $globalref
global $globalref;
- $globalref[] = &$this;
+ $globalref[] = &$this;
// set name to passed value
$this->setName($name);
// and put it out
@@ -217,7 +217,7 @@
}
function echoName() {
- echo "<br>",$this->Name;
+ echo "<br>",$this->Name;
}
function setName($name) {
@@ -226,11 +226,12 @@
}
</programlisting>
</informalexample>
-
+ </para>
+
<para>
Let us check out if there is a difference between <varname>$bar1</varname> which
has been created using the copy <literal>=</literal> operator
- and <varname>$bar2</varname> which has been created using the reference
<literal>=&</literal> operator...
- </para>
+ and <varname>$bar2</varname> which has been created using the reference
+<literal>=&</literal> operator...
+
<informalexample>
<programlisting role="php">
@@ -244,7 +245,7 @@
set in constructor
set in constructor */
- $bar2 =& new foo('set in constructor');
+ $bar2 =& new foo('set in constructor');
$bar2->echoName();
$globalref[1]->echoName();
@@ -255,7 +256,7 @@
</programlisting>
</informalexample>
-
+ </para>
<para>
Apparently there is no difference, but in fact there is a very significant one:
<varname>$bar1</varname> and <varname>$globalref[0]</varname> are _NOT_
referenced, they are NOT the same variable.
@@ -270,7 +271,7 @@
</simpara>
</note>
To prove what is written above let us watch the code below.
- </para>
+
<informalexample>
<programlisting role="php">
@@ -300,7 +301,7 @@
</programlisting>
</informalexample>
-
+ </para>
<para>
Another final example, try to understand it.
@@ -319,26 +320,26 @@
}
function echoValue() {
- echo "<br>","class ",get_class($this),': ',$this->value;
+ echo "<br>","class ",get_class($this),': ',$this->value;
}
}
class b {
- function b(&$a) {
- $this->a = &$a;
+ function b(&$a) {
+ $this->a = &$a;
}
function echoValue() {
- echo "<br>","class ",get_class($this),': ',$this->a->value;
+ echo "<br>","class ",get_class($this),': ',$this->a->value;
}
}
// try to undestand why using a simple copy here would yield
// in an undesired result in the *-marked line
-$a =& new a(10);
+$a =& new a(10);
$a->createRef();
$a->echoValue();
@@ -361,8 +362,8 @@
class b: 11
*/
</programlisting>
- </informalexample>
-</para>
+ </informalexample>
+ </para>
</sect1>