Re: each() bug? Can you try this to verify?

From: Date: Sat, 26 Aug 2000 00:59:47 +0000
Subject: Re: each() bug? Can you try this to verify?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13764@lists.php.net to get a copy of this message
At 05:56 PM 8/25/2000 -0600, Hans H. Anderson wrote:
<?php //$array = array("hans"=>"brent"); $array = array("hans"=>"brent","annie"=>"anne"); print sizeof($array) . "\n"; // loop, output data while(list($k,$v) = each($array)) {
        print "k=v: $k=$v\n";
} print sizeof($array) . "\n"; // loop again, should output the same data, but doesn't on my machine while(list($k,$v) = each($array)) {
        print "k=v: $k=$v\n";
} print sizeof($array) . "\n"; print "Where are the values of array on the second loop? GONE! Why?\n"; ?>
Don't you need to reset() the array before using it again ? Joao -- Joao Prado Maia Web Developer Kefta.com, Inc

« previous php.general (#13764) next »