reference/array/functions/key.xml
0a192fcd9cc43c0007de795063b4494974058992
...
...
@@ -9,8 +9,8 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>mixed</type><methodname>key</methodname>
13
-
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
12
+
<type class="union"><type>int</type><type>string</type><type>null</type></type><methodname>key</methodname>
13
+
<methodparam><type class="union"><type>array</type><type>object</type></type><parameter>array</parameter></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
<function>key</function> returns the index element of the current array
...
...
@@ -42,6 +42,24 @@
42
42
empty, <function>key</function> returns &null;.
43
43
</para>
44
44
</refsect1>
45
+

46
+
<refsect1 role="changelog">
47
+
&reftitle.changelog;
48
+
<informaltable>
49
+
<tgroup cols="2">
50
+
<thead>
51
+
<row>
52
+
<entry>&Version;</entry>
53
+
<entry>&Description;</entry>
54
+
</row>
55
+
</thead>
56
+
<tbody>
57
+
&standard.changelog.calling-on-objects;
58
+
</tbody>
59
+
</tgroup>
60
+
</informaltable>
61
+
</refsect1>
62
+

45
63
<refsect1 role="examples">
46
64
&reftitle.examples;
47
65
<para>
...
...
@@ -61,7 +79,7 @@ $array = array(
61
79
// key where value equals "apple"
62
80
while ($fruit_name = current($array)) {
63
81
if ($fruit_name == 'apple') {
64
-
echo key($array).'<br />';
82
+
echo key($array), "\n";
65
83
}
66
84
next($array);
67
85
}
...
...
@@ -71,9 +89,9 @@ while ($fruit_name = current($array)) {
71
89
&example.outputs;
72
90
<screen>
73
91
<![CDATA[
74
-
fruit1<br />
75
-
fruit4<br />
76
-
fruit5<br />
92
+
fruit1
93
+
fruit4
94
+
fruit5
77
95
]]>
78
96
</screen>
79
97
</example>
...
...
@@ -85,11 +103,12 @@ fruit5<br />
85
103
<simplelist>
86
104
<member><function>current</function></member>
87
105
<member><function>next</function></member>
106
+
<member><function>array_key_first</function></member>
107
+
<member><link linkend="control-structures.foreach">foreach</link></member>
88
108
</simplelist>
89
109
</para>
90
110
</refsect1>
91
111
</refentry>
92
-

93
112
<!-- Keep this comment at the end of the file
94
113
Local variables:
95
114
mode: sgml
96
115