reference/reflection/reflectionclass/getconstant.xml
ec2fe9a592f794978114ef5021db9f1d00c2e05d
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<refentry xml:id="reflectionclass.getconstant" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>ReflectionClass::getConstant</refname>
...
...
@@ -9,16 +8,13 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis>
11
+
<methodsynopsis role="ReflectionClass">
13
12
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionClass::getConstant</methodname>
14
13
<methodparam><type>string</type><parameter>name</parameter></methodparam>
15
14
</methodsynopsis>
16
15
<para>
17
16
Gets the defined constant.
18
17
</para>
19
-

20
-
&warn.undocumented.func;
21
-

22
18
</refsect1>
23
19

24
20
<refsect1 role="parameters">
...
...
@@ -29,7 +25,7 @@
29
25
<term><parameter>name</parameter></term>
30
26
<listitem>
31
27
<para>
32
-
Name of the constant.
28
+
The name of the class constant to get.
33
29
</para>
34
30
</listitem>
35
31
</varlistentry>
...
...
@@ -40,7 +36,42 @@
40
36
<refsect1 role="returnvalues">
41
37
&reftitle.returnvalues;
42
38
<para>
43
-
Value of the constant.
39
+
Value of the constant with the name <parameter>name</parameter>.
40
+
Returns &false; if the constant was not found in the class.
41
+
</para>
42
+
</refsect1>
43
+
44
+
<refsect1 role="examples">
45
+
&reftitle.examples;
46
+
<para>
47
+
<example>
48
+
<title>Usage of <methodname>ReflectionClass::getConstant</methodname></title>
49
+
<programlisting role="php">
50
+
<![CDATA[
51
+
<?php
52
+

53
+
class Example {
54
+
const C1 = false;
55
+
const C2 = 'I am a constant';
56
+
}
57
+

58
+
$reflection = new ReflectionClass('Example');
59
+

60
+
var_dump($reflection->getConstant('C1'));
61
+
var_dump($reflection->getConstant('C2'));
62
+
var_dump($reflection->getConstant('C3'));
63
+
?>
64
+
]]>
65
+
</programlisting>
66
+
&example.outputs;
67
+
<screen>
68
+
<![CDATA[
69
+
bool(false)
70
+
string(15) "I am a constant"
71
+
bool(false)
72
+
]]>
73
+
</screen>
74
+
</example>
44
75
</para>
45
76
</refsect1>
46
77

...
...
@@ -54,7 +85,6 @@
54
85
</refsect1>
55
86

56
87
</refentry>
57
-

58
88
<!-- Keep this comment at the end of the file
59
89
Local variables:
60
90
mode: sgml
61
91