|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-26 23:21 UTC] judas dot iscariote at gmail dot com
[2014-12-31 16:28 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
-Package: Feature/Change Request
+Package: *General Issues
[2014-12-31 16:28 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 02:00:02 2025 UTC |
Description: ------------ Fatal error: Key element cannot be a reference Reproduce code: --------------- foreach($list as &$key=>&$value) { $key = $key+1; $value = $value+1; } This code will generate error: Fatal error: Key element cannot be a reference Expected result: ---------------- $list = array(1 => 2, 5 => 6); foreach($list as &$key=>&$value) { $key = $key+1; $value = $value+1; } Expected result: $list == array ( 2 => 3, 6 => 7 ) Actual result: -------------- Fatal error: Key element cannot be a reference