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>,
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php