php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49334 foreach by reference behavior
Submitted: 2009-08-23 10:27 UTC Modified: 2009-08-24 08:55 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: hueen at yahoo dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.10 OS: osx
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-08-23 10:27 UTC] hueen at yahoo dot com
Description:
------------
In regards to bug #29992

Does anything speak against having foreach() unset the "as" variable before iterating? I can hardly imagine anyone would want it to remain a reference when walking through an array.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-24 08:55 UTC] derick@php.net
It can be quite useful, especially when you break out of the foreach with a break. We can't really go about changing internals for yet another egde case.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 16:01:31 2024 UTC