|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-10-19 06:35 UTC] hholzgra@php.net
[2001-10-19 06:38 UTC] hholzgra@php.net
[2001-10-19 18:33 UTC] jeroen@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 09:00:01 2025 UTC |
I have a simple associative array of scalar name/value pairs -- specifically, the 50 US states and their abbreviations. The array is sorted using asort(). Two places in my script, I walk the array using the list/each syntax: while(list($abbr,$name) = each($STATES_HASH)) { ... } The first time, everything works as it should. All subsequent times however (within the same script) the array acts as though it's blank. If I query the size using sizeof(), it reports the correct value. If I try to extract values from the array, it works fine. If I make a copy of the array to a new variable, the copy works properly (the first time). It seems like there's a bug in the each() function. Looks almost as if every associative array has a pointer to the current element that's not getting reset when each() is done with it. My configure line is as follows: ?'./configure' '--prefix=/usr/local/php-4.0.6' '--with-apache=../apache_1.3.19' '--with-pgsql=/usr/local/pgsql' '--enable-track-vars' '--with-config-file-path=/etc' '--with-jpeg-dir=/usr/local' '--with-tiff-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib-dir=/usr/local' '--with-pdflib=/usr/local'