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
 [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

Pull Requests

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: Thu Dec 26 20:01:29 2024 UTC