php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67005 foreach documentation incomplete?
Submitted: 2014-04-02 09:58 UTC Modified: 2015-06-14 20:26 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: afhole at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 + 32 = ?
Subscribe to this entry?

 
 [2014-04-02 09:58 UTC] afhole at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/control-structures.foreach
---
The following note is missing from the EN docs:
"Unless the array is referenced, foreach operates on a copy of the specified array and not the array itself. foreach has some side effects on the array pointer. Don't rely on the array pointer during or after the foreach without resetting it."

Yet it is present on the Serbian docs: http://php.net/manual/sr/control-structures.foreach.php

Is this still the behaviour of foreach? It seems to be.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-16 00:08 UTC] dm@php.net
It is highly likely that Serbian documentation hasn't been updated for a while. The behavior you're describing is the "default" and is valid. To learn more about how foreach works, consult this answer by nikic@php.net: http://stackoverflow.com/a/14854568/424004

We will update the English documentation if it's missing some key notes.
 [2014-04-16 00:09 UTC] dm@php.net
-Status: Open +Status: Analyzed
 [2015-06-14 20:26 UTC] cmb@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-06-14 20:26 UTC] cmb@php.net
The Serbian translation is marked as inactive since 2011[1];
therefore it is not available from the language chooser select
element.

Inactive translations are typically grossly out-dated, and should
be read with an eye on the English original (if at all). Reporting
bugs regarding out-dated man pages is not really useful, as there
are tools which easily allow to see which pages are not
up-to-date[2].

[1] <https://github.com/php/web-php/commit/4209d7deb87c1ddf57fd933c2b05e875d6c9971f>
[2] <http://doc.php.net/>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 07:01:29 2024 UTC