mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
added example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@138076 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
25f8c09a49
commit
ff4dc961b3
1 changed files with 27 additions and 1 deletions
|
@ -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>
|
||||
|
@ -19,6 +19,32 @@
|
|||
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>,
|
||||
<function>each</function>, <function>next</function>,
|
||||
|
|
Loading…
Reference in a new issue