Array question
| From: | Paulson, Joseph V. \"Jay\" | Date: | Wed, 16 Aug 2000 16:28:55 +0000 |
| Subject: | Array question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12051@lists.php.net to get a copy of this message | ||
hello everyone!
I have a quick question about declaring an array. Below is the code snippet
that I am dealing with. What happens when i traverse the $select["options"]
position I only get the last two positions of the $selectOptions array.
Obviously, I need it to traverse all the positions in the $select["options"]
array. I don't have a clue as to why this is only traversing the last two
positions (no matter how many elements are in the array), but any help would
be greatly appreciated!
$selectOptions = array("label"=>";lkj",
"value"=>"l;kj;", "label"=>"canada",
"value"=>"Canada", "label"=>"usa",
"value"=>"USA");
$select = array("type"=>"select", "name"=>"select",
"value"=>"canada",
"options"=>$selectOptions);
reset($select["options"]);
while (list($key, $value) = each($select["options"])){
$debugMsg .= "select[\"".$key."\"] =
".$value."<br>\n";
}
echo $debugMsg;
Thanks,
Jay Paulson
ps I am running PHP version 3.0.15