note 92886 added to control-structures.foreach

From: Date: Thu, 13 Aug 2009 04:54:12 +0000
Subject: note 92886 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-159428@lists.php.net to get a copy of this message
Since this bug is marked as bogus: http://bugs.php.net/bug.php?id=32088 If you have also run into this undocumented "feature" and dont want to rewrite all the code, here's the solution. Instead of: foreach ($a as $key => &$value) { unset($a[$key]); } use: foreach ($a as $key => $whatever) { $value = &$a[$key]; unset($a[$key]); } ---- Server IP: 64.71.164.2 Probable Submitter: 83.241.45.109 ---- Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php Edit -- https://master.php.net/note/edit/92886 Del: integrated -- https://master.php.net/note/delete/92886/integrated Del: useless -- https://master.php.net/note/delete/92886/useless Del: bad code -- https://master.php.net/note/delete/92886/bad+code Del: spam -- https://master.php.net/note/delete/92886/spam Del: non-english -- https://master.php.net/note/delete/92886/non-english Del: in docs -- https://master.php.net/note/delete/92886/in+docs Del: other reasons-- https://master.php.net/note/delete/92886 Reject -- https://master.php.net/note/reject/92886 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159428) next »