说明
数组的索引在PHP中可以不为数字:
<?php
$price 
= array("shoes"=>100,
               
"ball"=>1000);
               
//第一种输出方法
foreach($price as $thing => $value){
echo 
"$thing => $value<br />";
}

reset($price); //使用过each后还需要遍历数组的话就要reset一下了
//第二种方法
while(list($thing,$value) = each($price)){
echo 
"$thing - $value<br />";
}
?>
输出结果 shoes => 100
ball => 1000
shoes - 100
ball - 1000