mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Discourage using foreacha along with array pointers, "wont fix" side effects
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@245989 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9ed79ffe2a
commit
d1ef2aa672
1 changed files with 4 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.150 $ -->
|
||||
<!-- $Revision: 1.151 $ -->
|
||||
<chapter xml:id="language.control-structures" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -540,15 +540,9 @@ foreach (array_expression as $key => $value)
|
|||
<para>
|
||||
Unless the array is <link linkend="language.references">referenced</link>,
|
||||
<literal>foreach</literal> operates on a copy of
|
||||
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>
|
||||
the specified array and not the array itself.<literal>foreach</literal> has
|
||||
some side effets on the array pointer. Don't rely on the array pointer during
|
||||
or after the foreach without resetting it.</para>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue