Edit report at https://bugs.php.net/bug.php?id=60024&edit=1

 ID:                 60024
 Comment by:         DeveloperGuy2008 at yahoo dot com
 Reported by:        chealer at gmail dot com
 Summary:            Do not keep last element treated by foreach
                     referenced
 Status:             Open
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Please fix this. It creates a lot of hard to debug bugs.


Previous Comments:
------------------------------------------------------------------------
[2011-10-09 21:09:19] chealer at gmail dot com

Description:
------------
As explained on http://ca.php.net/manual/en/control-structures.foreach.php :

Warning

Reference of a $value and the last array element remain even after the foreach 
loop. It is recommended to destroy it by unset().


In my opinion, PHP shouldn't keep the last element referenced by default, but 
at least, please provide a syntax which will not keep it. The current 
situations causes bugs like https://bugs.php.net/bug.php?id=49386



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60024&edit=1

Reply via email to