language/oop5/overloading.xml
d6f54016d62904cfd8200604aadd5e3f0d9bad97
...
...
@@ -35,7 +35,7 @@
35
35
<note>
36
36
<para>
37
37
PHP's interpretation of <quote>overloading</quote> is
38
-
different than most object oriented languages. Overloading
38
+
different than most object-oriented languages. Overloading
39
39
traditionally provides the ability to have multiple methods
40
40
with the same name but different quantities and types of
41
41
arguments.
...
...
@@ -112,6 +112,18 @@
112
112
</para>
113
113
</note>
114
114

115
+
<note>
116
+
<para>
117
+
PHP will not call an overloaded method from within the same overloaded method.
118
+
That means, for example, writing <code>return $this->foo</code> inside of
119
+
<link linkend="object.get">__get()</link> will return <literal>null</literal>
120
+
and raise an <constant>E_WARNING</constant> if there is no <literal>foo</literal> property defined,
121
+
rather than calling <link linkend="object.get">__get()</link> a second time.
122
+
However, overload methods may invoke other overload methods implicitly (such as
123
+
<link linkend="object.set">__set()</link> triggering <link linkend="object.get">__get()</link>).
124
+
</para>
125
+
</note>
126
+

115
127
<example>
116
128
<title>
117
129
Overloading properties via the <link linkend="object.get">__get()</link>,
...
...
@@ -174,8 +186,6 @@ class PropertyTest
174
186
}
175
187

176
188

177
-
echo "<pre>\n";
178
-

179
189
$obj = new PropertyTest;
180
190

181
191
$obj->a = 1;
182
192