language/oop5/overloading.xml
2ab7e9d763666526942ed4477c4f876beb160892
...
...
@@ -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>,
118
130