language/oop5/paamayim-nekudotayim.xml
d6f54016d62904cfd8200604aadd5e3f0d9bad97
...
...
@@ -6,9 +6,12 @@
6
6
<para>
7
7
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in
8
8
simpler terms, the double colon, is a token that allows access to
9
-
<link linkend="language.oop5.static">static</link>,
10
-
<link linkend="language.oop5.constants">constant</link>, and overridden
11
-
properties or methods of a class.
9
+
a <link linkend="language.oop5.constants">constant</link>,
10
+
<link linkend="language.oop5.static">static</link> property,
11
+
or <link linkend="language.oop5.static">static</link> method
12
+
of a class or one of its parents.
13
+
Moreover, static properties or methods can be overriden via
14
+
<link linkend="language.oop5.late-static-bindings">late static binding</link>.
12
15
</para>
13
16

14
17
<para>
...
...
@@ -17,7 +20,7 @@
17
20
</para>
18
21

19
22
<para>
20
-
As of PHP 5.3.0, it's possible to reference the class using a variable.
23
+
It's possible to reference the class using a variable.
21
24
The variable's value can not be a keyword (e.g. <literal>self</literal>,
22
25
<literal>parent</literal> and <literal>static</literal>).
23
26
</para>
...
...
@@ -39,7 +42,7 @@ class MyClass {
39
42
}
40
43

41
44
$classname = 'MyClass';
42
-
echo $classname::CONST_VALUE; // As of PHP 5.3.0
45
+
echo $classname::CONST_VALUE;
43
46

44
47
echo MyClass::CONST_VALUE;
45
48
?>
...
...
@@ -58,6 +61,10 @@ echo MyClass::CONST_VALUE;
58
61
<programlisting role="php">
59
62
<![CDATA[
60
63
<?php
64
+
class MyClass {
65
+
const CONST_VALUE = 'A constant value';
66
+
}
67
+

61
68
class OtherClass extends MyClass
62
69
{
63
70
public static $my_static = 'static var';
...
...
@@ -69,7 +76,7 @@ class OtherClass extends MyClass
69
76
}
70
77

71
78
$classname = 'OtherClass';
72
-
echo $classname::doubleColon(); // As of PHP 5.3.0
79
+
$classname::doubleColon();
73
80

74
81
OtherClass::doubleColon();
75
82
?>
...
...
@@ -78,7 +85,7 @@ OtherClass::doubleColon();
78
85
</example>
79
86

80
87
<para>
81
-
When an extending class overrides the parents definition of a method,
88
+
When an extending class overrides the parent's definition of a method,
82
89
PHP will not call the parent's method. It's up to the extended class
83
90
on whether or not the parent's method is called. This also applies to <link
84
91
linkend="language.oop5.decon">Constructors and Destructors</link>, <link
...
...
@@ -121,7 +128,6 @@ $class->myFunc();
121
128
</para>
122
129

123
130
</sect1>
124
-

125
131
<!-- Keep this comment at the end of the file
126
132
Local variables:
127
133
mode: sgml
128
134