nlopess Tue Apr 13 10:20:12 2004 EDT
Modified files: /phpdoc/en/reference/spl/functions ArrayIterator-current.xml ArrayIterator-valid.xml ArrayObject-construct.xml ArrayObject-getIterator.xml Log: some initial docs and examples for spl/arrays #can somebody check my poor english, please? http://cvs.php.net/diff.php/phpdoc/en/reference/spl/functions/ArrayIterator-current.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc/en/reference/spl/functions/ArrayIterator-current.xml diff -u phpdoc/en/reference/spl/functions/ArrayIterator-current.xml:1.2 phpdoc/en/reference/spl/functions/ArrayIterator-current.xml:1.3 --- phpdoc/en/reference/spl/functions/ArrayIterator-current.xml:1.2 Sun Apr 11 10:54:24 2004 +++ phpdoc/en/reference/spl/functions/ArrayIterator-current.xml Tue Apr 13 10:20:11 2004 @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="function.ArrayIterator-current"> <refnamediv> <refname>ArrayIterator::current</refname> @@ -13,9 +13,43 @@ <type>mixed</type><methodname>ArrayIterator::current</methodname> <void/> </methodsynopsis> + <para> + This function returns the current array entry + </para> + <para> + <example> + <title><function>ArrayIterator::current</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$array = array('1' => 'one', + '2' => 'two', + '3' => 'three'); - &warn.undocumented.func; +$arrayobject = new ArrayObject($array); +$iterator = $arrayobject->getIterator(); +for($iterator = $arrayobject->getIterator(); + $iterator->valid(); + $iterator->next()) { + + echo $iterator->key() . ' => ' . $iterator->current() . "\n"; +} +?> +]]> + </programlisting> + <para> + The above example will output: + </para> + <screen> +<![CDATA[ +1 => one +2 => two +3 => three +]]> + </screen> + </example> + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml diff -u phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml:1.1 phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml:1.2 --- phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml:1.1 Sun Apr 11 10:36:33 2004 +++ phpdoc/en/reference/spl/functions/ArrayIterator-valid.xml Tue Apr 13 10:20:11 2004 @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.ArrayIterator-valid"> <refnamediv> <refname>ArrayIterator::valid</refname> @@ -13,9 +13,31 @@ <type>bool</type><methodname>ArrayIterator::valid</methodname> <void/> </methodsynopsis> + <para> + This function checks if the array contains any more entries. + </para> + <para> + <example> + <title><function>ArrayIterator::valid</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$array = array('1' => 'one'); - &warn.undocumented.func; +$arrayobject = new ArrayObject($array); +$iterator = $arrayobject->getIterator(); +var_dump($iterator->valid()); //bool(true) + +$iterator->next(); // advance to the next item + +//bool(false) because there is only one array element +var_dump($iterator->valid()); +?> +]]> + </programlisting> + </example> + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/spl/functions/ArrayObject-construct.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc/en/reference/spl/functions/ArrayObject-construct.xml diff -u phpdoc/en/reference/spl/functions/ArrayObject-construct.xml:1.2 phpdoc/en/reference/spl/functions/ArrayObject-construct.xml:1.3 --- phpdoc/en/reference/spl/functions/ArrayObject-construct.xml:1.2 Sun Apr 11 10:54:24 2004 +++ phpdoc/en/reference/spl/functions/ArrayObject-construct.xml Tue Apr 13 10:20:11 2004 @@ -1,21 +1,55 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="function.ArrayObject-construct"> <refnamediv> <refname>ArrayObject::__construct</refname> <refpurpose> - + Construct a new array object </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>void</type><methodname>ArrayObject::__construct</methodname> - <methodparam><type>mixed</type><parameter>ar</parameter></methodparam> + <methodparam><type>mixed</type><parameter>input</parameter></methodparam> </methodsynopsis> + <para> + This constructs a new array object. The <parameter>input</parameter> + parameter accepts an array or another ArrayObject. + </para> + <para> + <example> + <title><function>ArrayObject::__construct</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$array = array('1' => 'one', + '2' => 'two', + '3' => 'three'); - &warn.undocumented.func; +$arrayobject = new ArrayObject($array); +var_dump($arrayobject); +?> +]]> + </programlisting> + <para> + The above example will output: + </para> + <screen> +<![CDATA[ +object(ArrayObject)#1 (3) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" +} +]]> + </screen> + </example> + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml diff -u phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml:1.1 phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml:1.2 --- phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml:1.1 Tue Feb 24 05:51:40 2004 +++ phpdoc/en/reference/spl/functions/ArrayObject-getIterator.xml Tue Apr 13 10:20:11 2004 @@ -1,10 +1,10 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.ArrayObject-getIterator"> <refnamediv> <refname>ArrayObject::getIterator</refname> <refpurpose> - Create a new iterator from a ArrayObject instance + Create a new iterator from an ArrayObject instance </refpurpose> </refnamediv> <refsect1> @@ -13,9 +13,43 @@ <type>ArrayIterator</type><methodname>ArrayObject::getIterator</methodname> <void/> </methodsynopsis> + <para> + This function will return an iterator from an ArrayObject. + </para> + <para> + <example> + <title><function>ArrayObject::getIterator</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$array = array('1' => 'one', + '2' => 'two', + '3' => 'three'); - &warn.undocumented.func; +$arrayobject = new ArrayObject($array); +$iterator = $arrayobject->getIterator(); + +while($iterator->valid()) { + echo $iterator->key() . ' => ' . $iterator->current() . "\n"; + + $iterator->next(); +} +?> +]]> + </programlisting> + <para> + The above example will output: + </para> + <screen> +<![CDATA[ +1 => one +2 => two +3 => three +]]> + </screen> + </example> + </para> </refsect1> </refentry>