reference/classobj/functions/class-alias.xml
c992cd3eb5c4a030697c2f126cf023041b923944
...
...
@@ -9,13 +9,13 @@
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
11
<type>bool</type><methodname>class_alias</methodname>
12
-
<methodparam><type>string</type><parameter>original</parameter></methodparam>
12
+
<methodparam><type>string</type><parameter>class</parameter></methodparam>
13
13
<methodparam><type>string</type><parameter>alias</parameter></methodparam>
14
14
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter><initializer>&true;</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
Creates an alias named <parameter>alias</parameter>
18
-
based on the user defined class <parameter>original</parameter>.
18
+
based on the user defined class <parameter>class</parameter>.
19
19
The aliased class is exactly the same as the original class.
20
20
</para>
21
21
</refsect1>
...
...
@@ -24,7 +24,7 @@
24
24
<para>
25
25
<variablelist>
26
26
<varlistentry>
27
-
<term><parameter>original</parameter></term>
27
+
<term><parameter>class</parameter></term>
28
28
<listitem>
29
29
<para>
30
30
The original class.
...
...
@@ -43,7 +43,8 @@
43
43
<term><parameter>autoload</parameter></term>
44
44
<listitem>
45
45
<para>
46
-
Whether to autoload if the original class is not found.
46
+
Whether to <link linkend="language.oop5.autoload">autoload</link>
47
+
if the original class is not found.
47
48
</para>
48
49
</listitem>
49
50
</varlistentry>
...
...
@@ -66,23 +67,23 @@
66
67
<![CDATA[
67
68
<?php
68
69

69
-
class foo { }
70
+
class Foo { }
70
71

71
-
class_alias('foo', 'bar');
72
+
class_alias('Foo', 'Bar');
72
73

73
-
$a = new foo;
74
-
$b = new bar;
74
+
$a = new Foo;
75
+
$b = new Bar;
75
76

76
77
// the objects are the same
77
78
var_dump($a == $b, $a === $b);
78
79
var_dump($a instanceof $b);
79
80

80
81
// the classes are the same
81
-
var_dump($a instanceof foo);
82
-
var_dump($a instanceof bar);
82
+
var_dump($a instanceof Foo);
83
+
var_dump($a instanceof Bar);
83
84

84
-
var_dump($b instanceof foo);
85
-
var_dump($b instanceof bar);
85
+
var_dump($b instanceof Foo);
86
+
var_dump($b instanceof Bar);
86
87

87
88
?>
88
89
]]>
...
...
@@ -102,6 +103,18 @@ bool(true)
102
103
</example>
103
104
</para>
104
105
</refsect1>
106
+
<refsect1 role="notes">
107
+
&reftitle.notes;
108
+
<note>
109
+
<para>
110
+
Class names are case-insensitive in PHP, and this is reflected in this
111
+
function. Aliases created by <function>class_alias</function> are declared
112
+
in lowercase. This means that for a class
113
+
<literal>MyClass</literal>, the <code>class_alias('MyClass', 'MyClassAlias')</code>
114
+
call will declare a new class alias named <literal>myclassalias</literal>.
115
+
</para>
116
+
</note>
117
+
</refsect1>
105
118
<refsect1 role="seealso">
106
119
&reftitle.seealso;
107
120
<para>
...
...
@@ -112,7 +125,6 @@ bool(true)
112
125
</para>
113
126
</refsect1>
114
127
</refentry>
115
-

116
128
<!-- Keep this comment at the end of the file
117
129
Local variables:
118
130
mode: sgml
119
131