ID: 13741 Updated by: hholzgra Reported By: [EMAIL PROTECTED] Old Status: Open Status: Bogus Bug Type: Arrays related Operating System: FreeBSD 4.2-RELEASE PHP Version: 4.0.6 New Comment:
see http://php.net/reset Previous Comments: ------------------------------------------------------------------------ [2001-10-19 06:19:43] [EMAIL PROTECTED] 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' ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13741&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]