|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-05-05 22:07 UTC] ben at bravenet dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ After a foreach() on an array, key() won't return a value from the same array. It looks like an internal array pointer problem, since a reset() before key() appears to fix it. Reproduce code: --------------- <?php $foo = array('a'=>'1', 'b'=>'2', 'c'=>'3'); foreach($foo as $k=>$v) { echo "$k=>$v\n"; } // reset($foo); // this fixes the problem echo key($foo); ?> Expected result: ---------------- a=>1 b=>2 c=>3 a Actual result: -------------- a=>1 b=>2 c=>3