Add note about foreach operating on a copy of the array, not the array itself.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@27451 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sterling Hughes 2000-07-01 00:23:04 +00:00
parent 018b3e8f5a
commit 4fc9f1307b

View file

@ -457,13 +457,26 @@ foreach(array_expression as $key => $value) statement
element's key will be assigned to the variable
<literal>$key</literal> on each loop.
</simpara>
<simpara>
When <literal>foreach</literal> first starts executing, the
internal array pointer is automatically reset to the first element
of the array. This means that you do not need to call
<function>reset</function> before a <literal>foreach</literal>
loop.
</simpara>
<para>
<note>
<para>
When <literal>foreach</literal> first starts executing, the
internal array pointer is automatically reset to the first element
of the array. This means that you do not need to call
<function>reset</function> before a <literal>foreach</literal>
loop.
</para>
</note>
</para>
<para>
<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 like with the each construct.
</para>
</note>
</para>
<para>
You may have noticed that the following are functionally
identical: