On Sat, April 30, 2005 8:16 pm, Rasmus Lerdorf said: >> php -a >> <?php >> $foo = array('a'=>'apple', 'b'=>'banana', 'c'=>'coconut'); >> while (list($k, $v) = each($foo)){ >> echo "$k: $v\n"; >> } >> ?> >> Content-type: text/html >> X-Powered-By: PHP/4.3.11 >> >> a: apple >> b: banana >> c: coconut >> >> It has worked just fine with alpha indices since PHP 3.0rc2, at a >> minimum, >> cuz I've been doing it that long. >> >> I dunno who was smoking what that day they typed the documentation :-) >> >> I'm pretty sure it's not an "undocumented feature" that it works. > > Richard, this is what the docs are talking about: > > list($a,$b,$c,$d) = array('a','b','c','d'); > echo $a,$b,$c,$d; > > vs. > > list($a,$b,$c,$d) = array('a'=>'a','b'=>'b','c'=>'c','d'=>'d'); > echo $a,$b,$c,$d; > > In your case you are calling each() which itself returns a numerically > indexed array. I realized how stupid my post was about 30 seconds after sending it. I plead sleep deprivation :-) The correct answer, of course, was http://php.net/extract -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php