Just fix one small grammatical and a couple of small presentation errors.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@130697 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Torben Wilson 2003-06-09 07:36:01 +00:00
parent 249e4eaffd
commit 43cfc76e3b

View file

@ -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 @@ for (expr1; expr2; expr3): statement; ...; endfor;
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 @@ foreach(array_expression as $key => $value) statement
<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 @@ $a = array (1, 2, 3, 17);
$i = 0; /* for illustrative purposes only */
foreach($a as $v) {
foreach ($a as $v) {
print "\$a[$i] => $v.\n";
$i++;
}
@ -598,7 +598,7 @@ $a = array (
"seventeen" => 17
);
foreach($a as $k => $v) {
foreach ($a as $k => $v) {
print "\$a[$k] => $v.\n";
}
@ -609,7 +609,7 @@ $a[0][1] = "b";
$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($a as $v1) {
/* 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";
}
]]>