torben Mon Jun 9 03:36:01 2003 EDT Modified files: /phpdoc/en/language control-structures.xml Log: Just fix one small grammatical and a couple of small presentation errors. Index: phpdoc/en/language/control-structures.xml diff -u phpdoc/en/language/control-structures.xml:1.75 phpdoc/en/language/control-structures.xml:1.76 --- phpdoc/en/language/control-structures.xml:1.75 Wed Jun 4 02:38:44 2003 +++ phpdoc/en/language/control-structures.xml Mon Jun 9 03:36:01 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.75 $ --> +<!-- $Revision: 1.76 $ --> <chapter id="control-structures"> <title>Control Structures</title> @@ -476,13 +476,13 @@ like Perl and some other languages. This simply gives an easy way to iterate over arrays. <literal>foreach</literal> works only on arrays, and will issue an error when you try to use it on a variable with a different - data type or an uninitialized variables. There are two syntaxes; the + data type or an uninitialized variable. There are two syntaxes; the second is a minor but useful extension of the first: <informalexample> <programlisting> <![CDATA[ -foreach(array_expression as $value) statement -foreach(array_expression as $key => $value) statement +foreach (array_expression as $value) statement +foreach (array_expression as $key => $value) statement ]]> </programlisting> </informalexample> @@ -514,14 +514,14 @@ <note> <para> Also note that <literal>foreach</literal> operates on a copy of - the specified array, not the array itself, therefore the array - pointer is not modified as with the <function>each</function> - construct and changes to the array element returned are not - reflected in the original array. However, the internal pointer - of the original array <emphasis>is</emphasis> advanced with - the processing of the array. Assuming the foreach loop runs - to completion, the array's internal pointer will be at the - end of the array. + the specified array and not the array itself. Therefore, the + array pointer is not modified as with the + <function>each</function> construct, and changes to the array + element returned are not reflected in the original array. + However, the internal pointer of the original array + <emphasis>is</emphasis> advanced with the processing of the + array. Assuming the foreach loop runs to completion, the + array's internal pointer will be at the end of the array. </para> </note> </para> @@ -584,7 +584,7 @@ $i = 0; /* for illustrative purposes only */ -foreach($a as $v) { +foreach ($a as $v) { print "\$a[$i] => $v.\n"; $i++; } @@ -598,7 +598,7 @@ "seventeen" => 17 ); -foreach($a as $k => $v) { +foreach ($a as $k => $v) { print "\$a[$k] => $v.\n"; } @@ -609,7 +609,7 @@ $a[1][0] = "y"; $a[1][1] = "z"; -foreach($a as $v1) { +foreach ($a as $v1) { foreach ($v1 as $v2) { print "$v2\n"; } @@ -617,7 +617,7 @@ /* foreach example 5: dynamic arrays */ -foreach(array(1, 2, 3, 4, 5) as $v) { +foreach (array(1, 2, 3, 4, 5) as $v) { print "$v\n"; } ]]>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php