list() = each() Question
| From: | Jason Mowat | Date: | Wed, 07 Feb 2001 16:01:20 +0000 |
| Subject: | list() = each() Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38552@lists.php.net to get a copy of this message | ||
Greets,
I have a quick question:
$Array = array(
"val1" => "Value 1",
"val2" => "Value 2",
"val3" => "Value 3"
);
while(list($a,$b,$c,$d) = each($Array)) {
print "$a = $c and $b = $d <br>";
}
Doesn't the "each" construct return a 4 element array, where element 1's
index is 0, element 2's index is 1, element 3's index is "key" and element
4's index is "value"? Now, if that is the case, the above should work,
right? I should create a list containing $a, $b, $c and $d, where $a and $c
contain key information, and $b and $d contain value information? For some
reason, $c and $d are NULL...
What am I missing here?
Cheers,
Jason