cvs: phpdoc /en/reference/array/functions reset.xml

From: Date: Sun, 17 Aug 2003 12:12:48 +0000
Subject: cvs: phpdoc /en/reference/array/functions reset.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969355865@lists.php.net to get a copy of this message
cece Sun Aug 17 08:12:48 2003 EDT Modified files: /phpdoc/en/reference/array/functions reset.xml Log: added example Index: phpdoc/en/reference/array/functions/reset.xml diff -u phpdoc/en/reference/array/functions/reset.xml:1.5 phpdoc/en/reference/array/functions/reset.xml:1.6 --- phpdoc/en/reference/array/functions/reset.xml:1.5 Mon Jun 16 08:03:39 2003 +++ phpdoc/en/reference/array/functions/reset.xml Sun Aug 17 08:12:48 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.reset"> <refnamediv> @@ -18,6 +18,32 @@ <function>reset</function> rewinds <parameter>array</parameter>'s internal pointer to the first element and returns the value of the first array element. + </para> + <para> + <example> + <title><fucntion>reset</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$array = array('step one', 'step two', 'step three', 'step four'); + +// by default, the pointer is on the first element +echo current($array)."<br>\n"; // step "one" + +// skip two steps +next($array); +next($array); +echo current($array)."<br>\n"; // "step three" + +// reset pointer, start again on step one +reset($array); +echo current($array)."<br>\n"; // "step one" + +?> +]]> + </programlisting> + </example> </para> <para> See also <function>current</function>,

« previous php.doc (#969355865) next »