philip Fri Jul 18 04:31:09 2003 EDT Modified files: /phpdoc/en/reference/array/functions prev.xml current.xml next.xml end.xml Log: Properly document the word "element" as an array key/value pair, and "value" as the value. This almost closes bug #20394 Index: phpdoc/en/reference/array/functions/prev.xml diff -u phpdoc/en/reference/array/functions/prev.xml:1.4 phpdoc/en/reference/array/functions/prev.xml:1.5 --- phpdoc/en/reference/array/functions/prev.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/prev.xml Fri Jul 18 04:31:09 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.prev"> <refnamediv> @@ -13,7 +13,7 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - Returns the array element in the previous place that's pointed by + 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> @@ -29,6 +29,23 @@ <function>prev</function> behaves just like <function>next</function>, except it rewinds the internal array pointer one place instead of advancing it. + </para> + <para> + <example> + <title>Example use of <function>prev</function> and friends</title> + <programlisting role="php"> +<![CDATA[ +<?php +$transport = array('foot', 'bike', 'car', 'plane'); +$mode = current($transport); // $mode = 'foot'; +$mode = next($transport); // $mode = 'bike'; +$mode = next($transport); // $mode = 'car'; +$mode = prev($transport); // $mode = 'bike'; +$mode = end($transport); // $mode = 'plane'; +?> +]]> + </programlisting> + </example> </para> <para> See also <function>current</function>, <function>end</function>, Index: phpdoc/en/reference/array/functions/current.xml diff -u phpdoc/en/reference/array/functions/current.xml:1.6 phpdoc/en/reference/array/functions/current.xml:1.7 --- phpdoc/en/reference/array/functions/current.xml:1.6 Mon Mar 17 13:27:16 2003 +++ phpdoc/en/reference/array/functions/current.xml Fri Jul 18 04:31:09 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.current"> <refnamediv> @@ -19,8 +19,8 @@ </para> <para> The <function>current</function> function simply returns the - array element that's currently being pointed by the internal - pointer. It does not move the pointer in any way. If the + value of the array element that's currently being pointed to by the + 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> @@ -34,6 +34,24 @@ <function>each</function> function. </para> </warning> + </para> + <para> + <example> + <title>Example use of <function>current</function> and friends</title> + <programlisting role="php"> +<![CDATA[ +<?php +$transport = array('foot', 'bike', 'car', 'plane'); +$mode = current($transport); // $mode = 'foot'; +$mode = next($transport); // $mode = 'bike'; +$mode = current($transport); // $mode = 'bike'; +$mode = prev($transport); // $mode = 'foot'; +$mode = end($transport); // $mode = 'plane'; +$mode = current($transport); // $mode = 'plane'; +?> +]]> + </programlisting> + </example> </para> <para> See also <function>end</function>, <function>key</function>, Index: phpdoc/en/reference/array/functions/next.xml diff -u phpdoc/en/reference/array/functions/next.xml:1.4 phpdoc/en/reference/array/functions/next.xml:1.5 --- phpdoc/en/reference/array/functions/next.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/next.xml Fri Jul 18 04:31:09 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.next"> <refnamediv> @@ -15,15 +15,14 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - Returns the array element in the next place that's pointed by the - internal array pointer, or &false; if - there are no more elements. + Returns the array value in the next place that's pointed to by the + internal array pointer, or &false; if there are no more elements. </para> <para> <function>next</function> behaves like <function>current</function>, with one difference. It advances the internal array pointer one place forward before returning the - element. That means it returns the next array element and + element value. That means it returns the next array value and 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;. @@ -36,6 +35,23 @@ <function>each</function> function. </para> </warning> + </para> + <para> + <example> + <title>Example use of <function>next</function> and friends</title> + <programlisting role="php"> +<![CDATA[ +<?php +$transport = array('foot', 'bike', 'car', 'plane'); +$mode = current($transport); // $mode = 'foot'; +$mode = next($transport); // $mode = 'bike'; +$mode = next($transport); // $mode = 'car'; +$mode = prev($transport); // $mode = 'bike'; +$mode = end($transport); // $mode = 'plane'; +?> +]]> + </programlisting> + </example> </para> <para> See also Index: phpdoc/en/reference/array/functions/end.xml diff -u phpdoc/en/reference/array/functions/end.xml:1.5 phpdoc/en/reference/array/functions/end.xml:1.6 --- phpdoc/en/reference/array/functions/end.xml:1.5 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/end.xml Fri Jul 18 04:31:09 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.end"> <refnamediv> @@ -16,7 +16,8 @@ </methodsynopsis> <para> <function>end</function> advances <parameter>array</parameter>'s - internal pointer to the last element, and returns that element. + internal pointer to the last element, and returns the value from + the last element. </para> <para> <example>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php