Fix #37572 (Return value can be false on success)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@213911 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Etienne Kneuss 2006-05-29 16:03:18 +00:00
parent 1adf70c43a
commit e5de952ad1
3 changed files with 42 additions and 45 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.current">
<refnamediv>
@ -23,22 +23,18 @@
internal pointer. It does not move the pointer in any way. If the
internal pointer points beyond the end of the elements list,
<function>current</function> returns &false;.
<warning>
<para>
If the array contains empty elements (0 or "", the empty
string) then this function will return a value which
evaluates to &false; for these elements as well (see <link
linkend="language.types.boolean.casting">converting to boolean</link>
and <link linkend="types.comparisons">the type comparison tables</link>
for more information).
This makes it impossible to
determine if you are really at the end of the list in such
an array using <function>current</function>. To properly
traverse an array that may contain empty elements, use the
<function>each</function> function.
</para>
</warning>
</para>
&return.falseproblem;
<note>
<simpara>
You won't be able to distinguish the end of an array from a
<type>boolean</type> &false; element. To properly traverse an array
which may contain &false; elements, see the <function>each</function>
function.
</simpara>
</note>
<para>
<example>
<title>Example use of <function>current</function> and friends</title>
@ -59,8 +55,8 @@ $mode = current($transport); // $mode = 'plane';
</para>
<para>
See also <function>end</function>, <function>key</function>,
<function>next</function>, <function>prev</function>, and
<function>reset</function>.
<function>next</function>, <function>prev</function>,
<function>reset</function>, and <function>each</function>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.next">
<refnamediv>
@ -26,19 +26,18 @@
advances the internal array pointer by one. If advancing the
internal array pointer results in going beyond the end of the
element list, <function>next</function> returns &false;.
<warning>
<para>
If the array contains empty elements, or elements that have a key
value of 0 then this function will return a value which
evaluates to &false; for these elements as well (see <link
linkend="language.types.boolean.casting">converting to boolean</link>
and <link linkend="types.comparisons">the type comparison tables</link>
for more information). To properly traverse an array which
may contain empty elements or elements with key values of 0 see the
<function>each</function> function.
</para>
</warning>
</para>
&return.falseproblem;
<note>
<simpara>
You won't be able to distinguish the end of an array from a
<type>boolean</type> &false; element. To properly traverse an array
which may contain &false; elements, see the <function>each</function>
function.
</simpara>
</note>
<para>
<example>
<title>Example use of <function>next</function> and friends</title>
@ -59,7 +58,8 @@ $mode = end($transport); // $mode = 'plane';
<para>
See also
<function>current</function>, <function>end</function>,
<function>prev</function>, and <function>reset</function>.
<function>prev</function>, <function>reset</function>,
and <function>each</function>.
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
<refentry id="function.prev">
<refnamediv>
@ -16,18 +16,18 @@
Returns the array value in the previous place that's pointed to by
the internal array pointer, or &false; if there are no more
elements.
<warning>
<para>
If the array contains empty elements then this function will
return a value which evaluates to &false; for these elements as well
(see <link linkend="language.types.boolean.casting">converting to boolean</link>
and <link linkend="types.comparisons">the type comparison tables</link>
for more information).
To properly traverse an array which may contain empty elements
see the <function>each</function> function.
</para>
</warning>
</para>
&return.falseproblem;
<note>
<simpara>
You won't be able to distinguish the beginning of an array from a
<type>boolean</type> &false; element. To properly traverse an array
which may contain &false; elements, see the <function>each</function>
function.
</simpara>
</note>
<para>
<function>prev</function> behaves just like
<function>next</function>, except it rewinds the internal array
@ -52,7 +52,8 @@ $mode = end($transport); // $mode = 'plane';
</para>
<para>
See also <function>current</function>, <function>end</function>,
<function>next</function>, and <function>reset</function>.
<function>next</function>, <function>reset</function>,
and <function>each</function>.
</para>
</refsect1>
</refentry>