reference/array/functions/current.xml
0a192fcd9cc43c0007de795063b4494974058992
...
...
@@ -9,7 +9,7 @@
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
11
<type>mixed</type><methodname>current</methodname>
12
-
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
12
+
<methodparam><type class="union"><type>array</type><type>object</type></type><parameter>array</parameter></methodparam>
13
13
</methodsynopsis>
14
14
<para>
15
15
Every array has an internal pointer to its "current" element,
...
...
@@ -43,6 +43,24 @@
43
43
</para>
44
44
&return.falseproblem;
45
45
</refsect1>
46
+

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

46
64
<refsect1 role="examples">
47
65
&reftitle.examples;
48
66
<para>
...
...
@@ -74,10 +92,17 @@ var_dump(current($arr)); // array(0) { }
74
92
&reftitle.notes;
75
93
<note>
76
94
<simpara>
77
-
You won't be able to distinguish the end of an array from a
78
-
<type>boolean</type> &false; element. To properly traverse an array
79
-
which may contain &false; elements, see the <function>each</function>
80
-
function.
95
+
The results of calling <function>current</function> on an empty array
96
+
and on an array, whose internal pointer points beyond the end of the elements,
97
+
are indistinguishable from a <type>bool</type> &false; element.
98
+
To properly traverse an array which may contain &false; elements, see the
99
+
&foreach; control structure.
100
+
</simpara>
101
+
<simpara>
102
+
To still use <function>current</function> and properly check if the value
103
+
is really an element of the array, the <function>key</function>
104
+
of the <function>current</function> element should be checked to be strictly
105
+
different from &null;.
81
106
</simpara>
82
107
</note>
83
108
</refsect1>
...
...
@@ -91,11 +116,11 @@ var_dump(current($arr)); // array(0) { }
91
116
<member><function>prev</function></member>
92
117
<member><function>reset</function></member>
93
118
<member><function>next</function></member>
119
+
<member>&foreach;</member>
94
120
</simplelist>
95
121
</para>
96
122
</refsect1>
97
123
</refentry>
98
-

99
124
<!-- Keep this comment at the end of the file
100
125
Local variables:
101
126
mode: sgml
102
127