vrana Sun Oct 17 07:09:29 2004 EDT
Modified files: /phpdoc/en/language/oop5 iterations.xml Log: Change links to foreach Add missing ?> http://cvs.php.net/diff.php/phpdoc/en/language/oop5/iterations.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/language/oop5/iterations.xml diff -u phpdoc/en/language/oop5/iterations.xml:1.5 phpdoc/en/language/oop5/iterations.xml:1.6 --- phpdoc/en/language/oop5/iterations.xml:1.5 Sat Oct 2 05:40:50 2004 +++ phpdoc/en/language/oop5/iterations.xml Sun Oct 17 07:09:29 2004 @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <sect1 id="language.oop5.iterations"> <title>Object Iteration</title> <para> PHP 5 provides a way for objects to be defined so it is possible - to iterate through a list of items, with, for example a <xref - linkend="control-structures.foreach" /> statement. By default, all + to iterate through a list of items, with, for example a <link + linkend="control-structures.foreach">foreach</link> statement. By default, all public properties will be used for the iteration. </para> @@ -14,7 +14,6 @@ <programlisting role="php"> <![CDATA[ <?php - class MyClass { public $var1 = 'value 1'; @@ -30,6 +29,7 @@ foreach($class as $key => $value) { print "$key => $value\n"; } +?> ]]> </programlisting> &example.outputs; @@ -44,7 +44,7 @@ </example> <para> - As the output shows, the <xref linkend="control-structures.foreach" /> + As the output shows, the <link linkend="control-structures.foreach">foreach</link> iterated through each public variable that is defined. To take it a step further you can <varname>implement</varname> one of PHP 5's internal <xref linkend="language.oop5.interfaces" /> named @@ -104,6 +104,7 @@ foreach ($it as $a => $b) { print "$a: $b\n"; } +?> ]]> </programlisting> <para> @@ -171,9 +172,7 @@ foreach ($coll as $key => $val) { echo "key/value: [$key -> $val]\n\n"; } - ?> -</pre> ]]> </programlisting> <para>