completing spl/array docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@155856 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2004-04-13 15:14:06 +00:00
parent 4d76cf9220
commit 71f2a8edd2
3 changed files with 79 additions and 6 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry id="function.ArrayIterator-key">
<refnamediv>
<refname>ArrayIterator::key</refname>
@ -13,9 +13,26 @@
<type>mixed</type><methodname>ArrayIterator::key</methodname>
<void/>
</methodsynopsis>
<para>
This function returns the current array key
</para>
<para>
<example>
<title><function>ArrayIterator::key</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$array = array('key' => 'value');
&warn.undocumented.func;
$arrayobject = new ArrayObject($array);
$iterator = $arrayobject->getIterator();
echo $iterator->key(); //key
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.ArrayIterator-next">
<refnamediv>
<refname>ArrayIterator::next</refname>
@ -13,9 +13,41 @@
<type>void</type><methodname>ArrayIterator::next</methodname>
<void/>
</methodsynopsis>
<para>
This function moves the iterator to the next entry.
</para>
<para>
<example>
<title><function>ArrayIterator::next</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$arrayobject = new ArrayObject();
&warn.undocumented.func;
$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$iterator = $arrayobject->getIterator();
while($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
$iterator->next();
}
?>
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
0 => zero
1 => one
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.ArrayIterator-rewind">
<refnamediv>
<refname>ArrayIterator::rewind</refname>
@ -13,9 +13,33 @@
<type>void</type><methodname>ArrayIterator::rewind</methodname>
<void/>
</methodsynopsis>
<para>
This function rewinds the iterator to the begining.
</para>
<para>
<example>
<title><function>ArrayObject::rewind</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$arrayobject = new ArrayObject();
&warn.undocumented.func;
$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$arrayobject[] = 'two';
$iterator = $arrayobject->getIterator();
$iterator->next();
echo $iterator->key(); //1
$iterator->rewind(); //rewinding to the begining
echo $iterator->key(); //0
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>